618 lines
21 KiB
C#
618 lines
21 KiB
C#
|
|
using Newtonsoft.Json;
|
|||
|
|
using Newtonsoft.Json.Linq;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.IO;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Net;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
using WMS.Business;
|
|||
|
|
using WMS.Business.Base;
|
|||
|
|
using WMS.Business.Stock;
|
|||
|
|
using WMS.Common;
|
|||
|
|
using WMS.FrmPrint;
|
|||
|
|
using WMS.IData;
|
|||
|
|
using WMS.Model.Base;
|
|||
|
|
using WMS.Model.Stock;
|
|||
|
|
|
|||
|
|
namespace WMS.Frm.Base
|
|||
|
|
{
|
|||
|
|
public partial class FrmLocEdit : FormBase
|
|||
|
|
{
|
|||
|
|
public FrmLocEdit()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
List<StorageAreaLocationModel> locData = new List<StorageAreaLocationModel>();
|
|||
|
|
private void ctrlButtons4_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
string locid = string.Empty;
|
|||
|
|
void BindData()
|
|||
|
|
{
|
|||
|
|
// locData = IBussFactory<BussStorageAreaLocation>.Instance().GetTableDecId(comboBox1.Text);
|
|||
|
|
locData = IBussFactory<BussStorageAreaLocation>.Instance().GetLocStsData(comboBox1.Text);
|
|||
|
|
if (locData != null)
|
|||
|
|
{
|
|||
|
|
bindingSource1.DataSource = locData;
|
|||
|
|
if (index >= 0)
|
|||
|
|
{
|
|||
|
|
gridView4.FocusedRowHandle = index;
|
|||
|
|
gridView4.SelectRow(index);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
private void ctrlButtons2_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
IBussFactory<BussStorageAreaLocation>.Instance().InsertLocationInfo(20, 107, 6, 110);
|
|||
|
|
BindData();
|
|||
|
|
}
|
|||
|
|
void BinDevcideData()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
DataTable tb = IBussFactory<BussDecSts>.Instance().GetLogError(rgtLookLogic.EditValue.ToString());
|
|||
|
|
if (tb != null)
|
|||
|
|
{
|
|||
|
|
gridControlCustom1.DataSource = tb;
|
|||
|
|
if (tb.Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
comboBox1.Text = tb.Rows[0]["decid"].ToString();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
private void FrmLocEdit_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
BinDevcideData();
|
|||
|
|
BindData();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons5_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (locid.Trim().Length > 0)
|
|||
|
|
{
|
|||
|
|
DataTable tb= IBussFactory<Business.Stock.BussMIStock>.Instance().GetCtMisTable(locid);
|
|||
|
|
if (tb != null)
|
|||
|
|
{
|
|||
|
|
if (tb.Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
if (tb.Rows[0]["a"].ToString() != "0")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("有库存,不能修改为可入库");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
string STORAGE_ID = this.gridView4.GetFocusedRowCellValue("STORAGE_ID").ToString();
|
|||
|
|
|
|||
|
|
|
|||
|
|
IBussFactory<BussStorageAreaLocation>.Instance().UpdateLocCtlSts(locid, "0", STORAGE_ID);
|
|||
|
|
BindData();
|
|||
|
|
|
|||
|
|
MessageBox.Show("设置成功");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons3_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (locid.Trim().Length > 0)
|
|||
|
|
{
|
|||
|
|
string STORAGE_ID = this.gridView4.GetFocusedRowCellValue("STORAGE_ID").ToString();
|
|||
|
|
|
|||
|
|
IBussFactory<BussStorageAreaLocation>.Instance().UpdateLocCtlSts(locid, "1", STORAGE_ID);
|
|||
|
|
BindData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
int index = -1;
|
|||
|
|
private void gridView4_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (gridView4.RowCount > 0)
|
|||
|
|
{
|
|||
|
|
locid = gridView4.GetFocusedRowCellValue("LOCATION_ID").ToString();
|
|||
|
|
index = gridView4.FocusedRowHandle;
|
|||
|
|
t_locID.Text = locid;
|
|||
|
|
BinMisStock(locid);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons1_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void ctrlButtons6_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
WMS.Ctrl.LoadForm load = new WMS.Ctrl.LoadForm();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 70);
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("数据修改中 ...");
|
|||
|
|
foreach (StorageAreaLocationModel rLoc in locData)
|
|||
|
|
{
|
|||
|
|
locid = rLoc.LOCATION_ID;
|
|||
|
|
if (locid.Trim().Length > 0)
|
|||
|
|
{
|
|||
|
|
IBussFactory<BussStorageAreaLocation>.Instance().UpdateLocCtlSts(locid, "1", rgtLookLogic.EditValue.ToString());
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
|||
|
|
SystemCommon.ShowInfoMessageBox("修改成功");
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons7_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
WMS.Ctrl.LoadForm load = new WMS.Ctrl.LoadForm();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 70);
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("数据修改中 ...");
|
|||
|
|
foreach (StorageAreaLocationModel rLoc in locData)
|
|||
|
|
{
|
|||
|
|
locid = rLoc.LOCATION_ID;
|
|||
|
|
if (locid.Trim().Length > 0)
|
|||
|
|
{
|
|||
|
|
IBussFactory<BussStorageAreaLocation>.Instance().UpdateLocCtlSts(locid, "0", rgtLookLogic.EditValue.ToString());
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
|||
|
|
SystemCommon.ShowInfoMessageBox("修改成功");
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void checkBox2_CheckedChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons8_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
//if (comboBox1.Text .Trim().Length>0)
|
|||
|
|
//{
|
|||
|
|
// string locId = comboBox1.Text;
|
|||
|
|
// IBussFactory<BussAutoRk>.Instance().UpdateDecDataSts(locId,"0", rgtLookLogic.EditValue.ToString());
|
|||
|
|
// BinDevcideData();
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
ChangeModel("0","empty");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons9_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
ChangeModel("2","out");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (gridView1.RowCount == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
comboBox1.Text = gridView1.GetFocusedRowCellValue("DECID").ToString();
|
|||
|
|
locData = IBussFactory<BussStorageAreaLocation>.Instance().GetLocStsData(comboBox1.Text);
|
|||
|
|
if (locData != null)
|
|||
|
|
{
|
|||
|
|
bindingSource1.DataSource = locData;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons7_Click_1(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (comboBox1.Text != "all")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
string locId = comboBox1.Text;
|
|||
|
|
DataTable dt =IBussFactory<BussAutoRk>.Instance().GetTasks(locId);
|
|||
|
|
if(dt.Rows.Count>0)
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("该库口仍有任务");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataTable dt2 = IBussFactory<BussAutoRk>.Instance().GetTasks2(locId);
|
|||
|
|
if (dt2.Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("该库口仍有任务");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
string strJSONsend = string.Empty;
|
|||
|
|
JObject joReturn = new JObject
|
|||
|
|
(
|
|||
|
|
new JProperty("fromPort", locId),
|
|||
|
|
new JProperty("type", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss"))
|
|||
|
|
);
|
|||
|
|
strJSONsend = joReturn.ToString();
|
|||
|
|
IBussFactory<BussAutoRk>.Instance().UpdateDecDataSts(locId, "3", rgtLookLogic.EditValue.ToString());
|
|||
|
|
BinDevcideData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons6_Click_1(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
ChangeModel("1","in");
|
|||
|
|
//if (comboBox1.Text != "all")
|
|||
|
|
//{
|
|||
|
|
|
|||
|
|
// string locId = comboBox1.Text;
|
|||
|
|
// string strJSONsend = string.Empty;
|
|||
|
|
// string errText = string.Empty;
|
|||
|
|
// DataTable dt = IBussFactory<BussAutoRk>.Instance().GetTasks(locId);
|
|||
|
|
// if(dt.Rows.Count>0)
|
|||
|
|
// {
|
|||
|
|
// MessageBox.Show("该库口仍有任务");
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// DataTable dt2 = IBussFactory<BussAutoRk>.Instance().GetTasks2(locId);
|
|||
|
|
// if (dt2.Rows.Count > 0)
|
|||
|
|
// {
|
|||
|
|
// MessageBox.Show("该库口仍有任务");
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// JObject joReturn = new JObject
|
|||
|
|
// (
|
|||
|
|
// new JProperty("fromPort", locId),
|
|||
|
|
// new JProperty("type", "in")
|
|||
|
|
// );
|
|||
|
|
// strJSONsend = joReturn.ToString();
|
|||
|
|
// string resJson = PostJSON("http://192.168.133:8082/fromWms/pattern", strJSONsend, ref errText);
|
|||
|
|
// JObject strJo2 = (JObject)JsonConvert.DeserializeObject(resJson);
|
|||
|
|
// string returnStatus = strJo2["returnStatus"].ToString().Trim();//请求结果
|
|||
|
|
// string returnInfo = strJo2["returnInfo"].ToString().Trim();//请求结果描述
|
|||
|
|
// if (returnStatus == "0")
|
|||
|
|
// {
|
|||
|
|
// IBussFactory<BussAutoRk>.Instance().UpdateDecDataSts(locId, "1", rgtLookLogic.EditValue.ToString());
|
|||
|
|
// BinDevcideData();
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// MessageBox.Show("失败:"+returnInfo);
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void label3_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons10_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (t_locID.Text.Trim().Length == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("选择要冻结的库存");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (GVMiStock.RowCount == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该库位没有库存");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (SystemCommon.ShowMessageBoxResultCancel("确定要冻结库存") == DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
string locId = t_locID.Text;
|
|||
|
|
IBussFactory<BussMIStock>.Instance().UpdateMisLoc(locId, "1");
|
|||
|
|
BinMisStock(locId);
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
void BinMisStock(string locId)
|
|||
|
|
{
|
|||
|
|
DataTable tb = IBussFactory<BussMIStock>.Instance().GetMisDataOut(locId,"", rgtLookLogic.EditValue.ToString());
|
|||
|
|
|
|||
|
|
if (tb != null)
|
|||
|
|
{
|
|||
|
|
List<MIStockModel> MIStock = ConvertHelper<MIStockModel>.ConvertToList(tb);
|
|||
|
|
if(MIStock!=null)
|
|||
|
|
bgsStock.DataSource = MIStock;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
private void ctrlButtons11_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (t_locID.Text.Trim().Length == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("选择要冻结的库存");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (GVMiStock.RowCount == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该库位没有库存");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (SystemCommon.ShowMessageBoxResultCancel("确定要解冻库存") == DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
string locId = t_locID.Text;
|
|||
|
|
IBussFactory<BussMIStock>.Instance().UpdateMisLoc(locId, "0");
|
|||
|
|
BinMisStock(locId);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons12_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
BindData();
|
|||
|
|
BinDevcideData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons13_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
SaveFileDialog fileDialog = new SaveFileDialog();
|
|||
|
|
fileDialog.Title = "导出Excel";
|
|||
|
|
fileDialog.Filter = "Excel文件(*.xls)|*.xls";
|
|||
|
|
DialogResult dialogResult = fileDialog.ShowDialog(this);
|
|||
|
|
if (dialogResult == DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions();
|
|||
|
|
gridControlCustom2.ExportToXls(fileDialog.FileName);
|
|||
|
|
DevExpress.XtraEditors.XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void rgtLookLogic_EditValueChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void gridView4_CustomFilterDisplayText(object sender, DevExpress.XtraEditors.Controls.ConvertEditValueEventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void gridView4_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|||
|
|
{
|
|||
|
|
if(e.Column.Name.ToString()== "colSTATUS")
|
|||
|
|
{
|
|||
|
|
if (e.Value != null)
|
|||
|
|
{
|
|||
|
|
switch (e.Value.ToString())
|
|||
|
|
{
|
|||
|
|
case "1":
|
|||
|
|
e.DisplayText = "冻结";
|
|||
|
|
break;
|
|||
|
|
case "2":
|
|||
|
|
e.DisplayText = "有库存";
|
|||
|
|
break;
|
|||
|
|
case "0":
|
|||
|
|
e.DisplayText = "可入库";
|
|||
|
|
break;
|
|||
|
|
case "5":
|
|||
|
|
e.DisplayText = "异常库位";
|
|||
|
|
break;
|
|||
|
|
case "8":
|
|||
|
|
e.DisplayText = "通道";
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if(e.Column.Name.ToString() == "colISLOCK")
|
|||
|
|
{
|
|||
|
|
if (e.Value != null)
|
|||
|
|
{
|
|||
|
|
switch (e.Value.ToString())
|
|||
|
|
{
|
|||
|
|
case "1":
|
|||
|
|
e.DisplayText = "空托盘";
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
case "0":
|
|||
|
|
e.DisplayText = "正常库位";
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons14_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (gridView4.GetSelectedRows().Length == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("选择要打印的数据");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
int[] selct = gridView4.GetSelectedRows();
|
|||
|
|
for (int i = 0; i < selct.Length; i++)
|
|||
|
|
{
|
|||
|
|
int idx = selct[i];
|
|||
|
|
string printId = gridView4.GetRowCellValue(idx, "LOCATION_ID").ToString();
|
|||
|
|
if (!string.IsNullOrEmpty(printId))
|
|||
|
|
{
|
|||
|
|
BarCodeReport br = new BarCodeReport();
|
|||
|
|
br.GetInstance(printId, 10);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
#region HTTP通讯
|
|||
|
|
private string PostJSON(string url, string strPost, ref string errText)
|
|||
|
|
{
|
|||
|
|
errText = string.Empty;
|
|||
|
|
string result = string.Empty;
|
|||
|
|
//生成文件流
|
|||
|
|
byte[] buffer = Encoding.UTF8.GetBytes(strPost);
|
|||
|
|
//向流中写字符串
|
|||
|
|
StreamWriter mywriter = null;
|
|||
|
|
//根据url创建请求对象
|
|||
|
|
HttpWebRequest objrequest = (HttpWebRequest)WebRequest.Create(url);
|
|||
|
|
//设置发送方式
|
|||
|
|
objrequest.Method = "POST";
|
|||
|
|
objrequest.Timeout = 4000;
|
|||
|
|
//提交长度
|
|||
|
|
objrequest.ContentLength = buffer.Length;
|
|||
|
|
//发送内容格式
|
|||
|
|
objrequest.ContentType = "application/json";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
mywriter = new StreamWriter(objrequest.GetRequestStream());
|
|||
|
|
mywriter.Write(strPost);
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
errText = ex.Message;
|
|||
|
|
result = "发送JSON失败!"+ex.Message;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
finally
|
|||
|
|
{
|
|||
|
|
mywriter.Close();
|
|||
|
|
}
|
|||
|
|
//读取服务器返回信息c
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
HttpWebResponse objresponse = (HttpWebResponse)objrequest.GetResponse();
|
|||
|
|
using (StreamReader sr = new StreamReader(objresponse.GetResponseStream()))
|
|||
|
|
{
|
|||
|
|
result = sr.ReadToEnd();
|
|||
|
|
sr.Close();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception ex1)
|
|||
|
|
{
|
|||
|
|
errText = ex1.Message;
|
|||
|
|
result = "请求suray接口!" + ex1.Message;
|
|||
|
|
}
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 更改模式
|
|||
|
|
public void ChangeModel(string status,string send)
|
|||
|
|
{
|
|||
|
|
string locId = comboBox1.Text;
|
|||
|
|
string strJSONsend = string.Empty;
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
DataTable dt = IBussFactory<BussAutoRk>.Instance().GetTasks(locId);//入库
|
|||
|
|
if (dt.Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("该库口仍有任务");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DataTable dt2 = IBussFactory<BussAutoRk>.Instance().GetTasks2(locId);//出库
|
|||
|
|
if (dt2.Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("该库口仍有任务");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string sts = Getstatus(locId, send);
|
|||
|
|
if (sts=="0")
|
|||
|
|
{
|
|||
|
|
JObject joReturn = new JObject
|
|||
|
|
(
|
|||
|
|
new JProperty("fromPort", locId),
|
|||
|
|
new JProperty("type", send)
|
|||
|
|
);
|
|||
|
|
strJSONsend = joReturn.ToString();
|
|||
|
|
string resJson = PostJSON("http://10.50.68.61:8082/fromWms/pattern", strJSONsend, ref errText);
|
|||
|
|
if (errText.Length > 0)
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("调用suray接口失败:" + resJson);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
JObject strJo2 = (JObject)JsonConvert.DeserializeObject(resJson);
|
|||
|
|
string returnStatus = strJo2["returnStatus"].ToString().Trim();//请求结果
|
|||
|
|
string returnInfo = strJo2["returnInfo"].ToString().Trim();//请求结果描述
|
|||
|
|
if (returnStatus == "0")
|
|||
|
|
{
|
|||
|
|
IBussFactory<BussAutoRk>.Instance().UpdateDecDataSts(locId, status, rgtLookLogic.EditValue.ToString());
|
|||
|
|
BinDevcideData();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("失败:" + returnInfo);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MessageBox.Show("失败,提升机返回:" + sts);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 获取提升机状态
|
|||
|
|
public string Getstatus(string decid , string status)
|
|||
|
|
{
|
|||
|
|
string strJSONsend = string.Empty;
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
JObject joReturn = new JObject
|
|||
|
|
(
|
|||
|
|
new JProperty("fromPort", decid),
|
|||
|
|
new JProperty("type", status)
|
|||
|
|
);
|
|||
|
|
strJSONsend = joReturn.ToString();
|
|||
|
|
string resJson = PostJSON("http://10.50.68.61:8082/fromWms/selectStatus", strJSONsend, ref errText);
|
|||
|
|
if (errText.Length > 0)
|
|||
|
|
{
|
|||
|
|
return errText;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
JObject strJo2 = (JObject)JsonConvert.DeserializeObject(resJson);
|
|||
|
|
string returnStatus = strJo2["returnStatus"].ToString().Trim();//请求结果
|
|||
|
|
string returnInfo = strJo2["returnInfo"].ToString().Trim();//请求结果描述
|
|||
|
|
if (returnStatus == "0")
|
|||
|
|
{
|
|||
|
|
return returnStatus;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return returnInfo;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
private void ctrlButtons15_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (locid.Trim().Length > 0)
|
|||
|
|
{
|
|||
|
|
string STORAGE_ID = this.gridView4.GetFocusedRowCellValue("STORAGE_ID").ToString();
|
|||
|
|
|
|||
|
|
IBussFactory<BussStorageAreaLocation>.Instance().UpdateLocislocklSts(locid, "1", STORAGE_ID);
|
|||
|
|
BindData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons16_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (locid.Trim().Length > 0)
|
|||
|
|
{
|
|||
|
|
string STORAGE_ID = this.gridView4.GetFocusedRowCellValue("STORAGE_ID").ToString();
|
|||
|
|
|
|||
|
|
IBussFactory<BussStorageAreaLocation>.Instance().UpdateLocislocklSts(locid, "0", STORAGE_ID);
|
|||
|
|
BindData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|