4398 lines
217 KiB
C#
4398 lines
217 KiB
C#
using DataCommon;
|
||
using Newtonsoft.Json;
|
||
using Newtonsoft.Json.Linq;
|
||
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.IO;
|
||
using System.Net;
|
||
using System.Net.Http;
|
||
using System.Text;
|
||
using System.Web.Http;
|
||
using System.Data.OracleClient;
|
||
using webapi.Data;
|
||
using static DataCommon.DatatableToEntity;
|
||
using System.Configuration;
|
||
using System.Xml;
|
||
using webapi.Modle;
|
||
using System.Net.Sockets;
|
||
using System.Reflection.PortableExecutable;
|
||
using webapi.Model;
|
||
using static webapi.Model.AGVTaskReport;
|
||
using System.Threading.Tasks;
|
||
using System.Diagnostics.Metrics;
|
||
using System.Threading;
|
||
|
||
namespace webapi.Controllers
|
||
{
|
||
public class apiController : ApiController
|
||
{
|
||
#region 测试接口
|
||
[HttpGet, Route("api/Demo")]
|
||
public HttpResponseMessage Asinfo()
|
||
{
|
||
Log.WriteLog("接受测试接口");
|
||
string dataJson = string.Empty;
|
||
dataJson = "{\"status\":1211\",\"errorCode\":22222\",\"errorInfo\":555555\" }";
|
||
|
||
HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(dataJson, System.Text.Encoding.GetEncoding("UTF-8"), "application/json") };
|
||
return result;
|
||
}
|
||
#endregion
|
||
#region 用户登入
|
||
[HttpGet, Route("api/WmsLogin")]
|
||
public HttpResponseMessage Login(string userId)
|
||
{
|
||
lock ("Login")
|
||
{
|
||
JObject jo = new JObject(
|
||
new JProperty("STS", ""),
|
||
new JProperty("Result", "")
|
||
);
|
||
|
||
Log.WriteLog("接收RF用户登入数据:" + userId);
|
||
try
|
||
{
|
||
|
||
string strSql = "select * from T_BASE_USERINFO where user_id='" + userId + "'";
|
||
DataSet ds = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql);
|
||
if (ds.Tables.Count > 0)
|
||
{
|
||
DataTable dt = ds.Tables[0];
|
||
if (dt != null)
|
||
{
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
jo["STS"] = "S";
|
||
jo["Result"] = JsonConvert.SerializeObject(dt);
|
||
}
|
||
else
|
||
{
|
||
jo["STS"] = "E";
|
||
jo["Result"] = "用户名不存在";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
jo["STS"] = "E";
|
||
jo["Result"] = "用户名不存在";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
jo["STS"] = "E";
|
||
jo["Result"] = "用户名不存在";
|
||
}
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
jo["STS"] = "E";
|
||
jo["Result"] = ex.Message;
|
||
|
||
}
|
||
HttpResponseMessage result = new HttpResponseMessage
|
||
{
|
||
Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
};
|
||
return result;
|
||
}
|
||
|
||
|
||
}
|
||
//#endregion
|
||
//#region 码盘入库
|
||
//[HttpPost, Route("api/WmsInvIn")]
|
||
//public HttpResponseMessage WmsInvIn([FromBody]JObject WmsInvIn)
|
||
//{
|
||
// lock ("WmsInvIn")
|
||
// {
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", ""),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// string mesJson = WmsInvIn.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收RF入库码盘数据:" + mesJson);
|
||
// OracleTransaction transaction = OracleHelper.BeginTransaction(OracleHelper.RemoteConnectionString);
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string userId = strJo["WmsInvIn"]["userId"].ToString().Trim();//用户id
|
||
// string formId = strJo["WmsInvIn"]["formId"].ToString().Trim();//组织id
|
||
// string locationId = strJo["WmsInvIn"]["LocationId"].ToString().Trim();//货位编号
|
||
// string barcodeListStr = strJo["WmsInvIn"]["BarcodeList"].ToString().Trim();//码盘信息storename
|
||
// DataTable dt = JsonConvert.DeserializeObject<DataTable>(barcodeListStr);
|
||
// Random rd = new Random();
|
||
// int next = rd.Next();
|
||
// string ctl = "CTL" + DateTime.Now.ToString("yyyymmddhhmmsssss") + next;
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// for (int i = 0; i < dt.Rows.Count; i++)
|
||
// {
|
||
// string Lotid = "SJ" + DateTime.Now.ToString("yyyymmddhhmmsssss");
|
||
// string outbarcode = dt.Rows[i]["outbarcode"].ToString();
|
||
// string sql = "select count(*) from T_ONGOODSSHELF where barcode='" + outbarcode + "'";
|
||
// if (int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sql).ToString()) > 0)
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = outbarcode + "存在库存中";
|
||
|
||
// HttpResponseMessage result1 = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result1;
|
||
// }
|
||
// else
|
||
// {
|
||
// string flag = "";
|
||
// string itmcode = dt.Rows[i]["itmcode"].ToString();
|
||
// string itmversion = dt.Rows[i]["storename"].ToString();
|
||
|
||
// string itmname = dt.Rows[i]["itmname"].ToString();
|
||
|
||
// string datecode = dt.Rows[i]["datecode"].ToString();
|
||
// string storename = dt.Rows[i]["storename"].ToString();
|
||
// string fbgtype = dt.Rows[i]["fbgtype"].ToString();
|
||
// string fgbno = dt.Rows[i]["fgbno"].ToString();
|
||
// string qty = dt.Rows[i]["qty"].ToString();
|
||
// if (storename != "3001" && itmversion != "3003")
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = outbarcode + "是" + storename + ",码盘失败";
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// HttpResponseMessage result1 = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "applicat" +
|
||
// "ion/json")
|
||
// };
|
||
// return result1;
|
||
// }
|
||
// string SqlStr = "insert into T_ONGOODSSHELF(LOT_ID,CTL,GOODSID,STO_NUM,ACC_NUM,SHELF_NUM,STOCK_NUM,Ondate,Onshelfuserid,Storage_Id,STORAGE_AREA_ID,GOODS_MEASURE_ID,Status,barcode,BAOZHIQI,REMARK,LOCATION_ID,TASKTYPE) values('" + Lotid + "','" + ctl + "','" + itmcode + "'," + qty + "," + qty + "," + qty + "," + qty + ",SYSDATE,'" + userId + "','" + formId + "','" + storename + "','" + itmversion + "','2','" + outbarcode + "','" + fbgtype + "','" + datecode + "','" + locationId + "','" + flag + "')";
|
||
// OracleHelper.ExecuteNonQuery(transaction, SqlStr);
|
||
// }
|
||
// }
|
||
|
||
// OracleHelper.CommitTransaction(transaction);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = "码盘成功";
|
||
|
||
// }
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "applicat" +
|
||
// "ion/json")
|
||
// };
|
||
// return result;
|
||
// }
|
||
|
||
|
||
//}
|
||
//#endregion
|
||
//#region 码盘入自动化立体库
|
||
//[HttpPost, Route("api/WmsInvInJw")]
|
||
//public HttpResponseMessage WmsInvInJw([FromBody]JObject WmsInvIn)
|
||
//{
|
||
// lock ("WmsInvInJw")
|
||
// {
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", ""),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// string mesJson = WmsInvIn.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收RF入库码盘数据:" + mesJson);
|
||
|
||
// OracleTransaction transaction = OracleHelper.BeginTransaction(OracleHelper.RemoteConnectionString);
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string userId = strJo["WmsInvIn"]["userId"].ToString().Trim();//用户id
|
||
// string formId = "JXJW";
|
||
// string decid = strJo["WmsInvIn"]["decid"].ToString().Trim();//货位编号
|
||
// string barcode = strJo["WmsInvIn"]["Barcode"].ToString().Trim();//码盘信息
|
||
// string pallet = strJo["WmsInvIn"]["ctl"].ToString().Trim();//码盘信息
|
||
// string sql = "select STS from T_DECNAME where decid='" + decid + "'";
|
||
// int mode = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sql).ToString());
|
||
// if (mode == 1)
|
||
// {
|
||
// sql = "select count(*) from T_ONGOODSSHELF where ctl='" + pallet + "'";
|
||
// int rows = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sql).ToString());
|
||
// if (rows == 0)
|
||
// {
|
||
// sql = "select count(*) from T_ONGOODSSHELF where (STORAGE_ID='JXJW' or STORAGE_ID='JXJWTH') and DECID='" + decid + "' and status=1 ";
|
||
// // sql = "select count(*) from T_ONGOODSSHELF where STORAGE_ID='JXJW' and DECID='" + decid + "' and (status=1 or pallet='" + pallet + "') ";
|
||
// rows = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sql).ToString());
|
||
// if (rows == 0)
|
||
// {
|
||
// sql = "select * from T_MI_STOCK where ctl='" + pallet + "'";
|
||
// string strSql = "select seq_plc_taskval.nextval from dual";
|
||
// string Plcid = OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).ToString();
|
||
// DataTable dt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, sql).Tables[0];
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
|
||
// for (int i = 0; i < dt.Rows.Count; i++)
|
||
// {
|
||
|
||
|
||
// string Lotid = "SJ" + DateTime.Now.ToString("yyyymmddhhmmsssss");
|
||
// string outbarcode = dt.Rows[i]["barcode"].ToString();
|
||
// string itmcode = dt.Rows[i]["GOODS_ID"].ToString();
|
||
// string itmversion = "";
|
||
// //string itmname = dt.Rows[i]["itmname"].ToString();
|
||
// string datecode = dt.Rows[i]["REMARK"].ToString();
|
||
// string storename = dt.Rows[i]["AREA_ID"].ToString();
|
||
// string fbgtype = "";
|
||
// string ctl = dt.Rows[i]["CTL"].ToString();
|
||
// // string fgbno = dt.Rows[i]["fgbno"].ToString();
|
||
// string qty = dt.Rows[i]["SHELVES_NUM"].ToString();
|
||
|
||
// string SqlStr = "insert into T_ONGOODSSHELF(LOT_ID,GOODSID,STO_NUM,ACC_NUM,SHELF_NUM,STOCK_NUM,Ondate,Onshelfuserid,Storage_Id,STORAGE_AREA_ID,GOODS_MEASURE_ID,Status,barcode,BAOZHIQI,REMARK,DECID,TASKTYPE,CTL,PLCID) values('" + Lotid + "','" + itmcode + "'," + qty + "," + qty + "," + qty + "," + qty + ",SYSDATE,'" + userId + "','" + formId + "','" + storename + "','" + itmversion + "','0','" + outbarcode + "','" + fbgtype + "','" + datecode + "','" + decid + "','1','" + ctl + "','" + Plcid + "')";
|
||
// OracleHelper.ExecuteNonQuery(transaction, SqlStr);
|
||
|
||
// }
|
||
|
||
// string cpj = "";
|
||
// if (decid == "A2")
|
||
// {
|
||
// cpj = "JW-12-40-01";
|
||
// }
|
||
// if (decid == "A3")
|
||
// {
|
||
// cpj = "JW-17-40-01";
|
||
// }
|
||
// JArray ja = new JArray();
|
||
// JObject jo1 = new JObject
|
||
// (
|
||
// new JProperty("taskId", "TRAN" + Guid.NewGuid().ToString()),
|
||
// new JProperty("taskType", "7"),
|
||
// new JProperty("startNode", cpj),
|
||
// new JProperty("endNode", decid),
|
||
// new JProperty("barCode", "1"),
|
||
// new JProperty("order", "0")
|
||
// );
|
||
// ja.Add(jo1);
|
||
// JObject joReturn = new JObject
|
||
// (
|
||
// new JProperty("groupId", "TRAN" + Guid.NewGuid().ToString()),
|
||
// new JProperty("msgTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss")),
|
||
// new JProperty("priorityCode", "1"),
|
||
// new JProperty("district", "JXJW"),
|
||
// new JProperty("tasks", ja)
|
||
// );
|
||
// string strJSONsend = joReturn.ToString();
|
||
// Log.WriteLog(strJSONsend);
|
||
// string errText = "";
|
||
// string resJson = PostJSON("http://10.50.68.61:8082/fromWms/taskReceive", strJSONsend, ref errText);
|
||
// Log.WriteLog("任务接收接口返回JSON:" + resJson);
|
||
// JObject strJo2 = (JObject)JsonConvert.DeserializeObject(resJson);
|
||
// string returnStatus = strJo2["returnStatus"].ToString().Trim();//请求结果
|
||
// string returnInfo = strJo2["returnInfo"].ToString().Trim();//请求结果描述
|
||
// if (returnStatus == "0")//成功
|
||
// {
|
||
// string SqlStrs = "delete from T_MI_STOCK where ctl='" + pallet + "'";
|
||
// OracleHelper.ExecuteNonQuery(transaction, SqlStrs);
|
||
// SqlStrs = "update T_ONGOODSSHELF set status=1 where ctl='" + pallet + "' ";
|
||
// OracleHelper.ExecuteNonQuery(transaction, SqlStrs);
|
||
// OracleHelper.CommitTransaction(transaction);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = "码盘成功";
|
||
// }
|
||
// else
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = "调用WCS接口拆盘接口失败";
|
||
// }
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = decid + "口正在执行任务,请稍后再试";
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = decid + "口正在执行任务,请稍后再试";
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = pallet + "已存在入库任务";
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = decid + "口,必须是入库模式才能码盘";
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
// }
|
||
|
||
|
||
//}
|
||
//#endregion
|
||
//#region 取消码盘入库
|
||
//[HttpPost, Route("api/cancelTaskRk")]
|
||
//public HttpResponseMessage cancelTaskRk([FromBody]JObject WmsInvIn)
|
||
//{
|
||
// lock ("cancelTaskRk")
|
||
// {
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", ""),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// string mesJson = WmsInvIn.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收取消码盘数据:" + mesJson);
|
||
|
||
// OracleTransaction transaction = OracleHelper.BeginTransaction(OracleHelper.RemoteConnectionString);
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string pallet = strJo["WmsInvIn"]["ctl"].ToString().Trim();//码盘信息
|
||
// Log.WriteLog(mesJson);
|
||
// string sql = "delete from T_MI_STOCK where ctl='" + pallet + "' and STORAGE_ID!='JXJW'";
|
||
// int rows = OracleHelper.ExecuteNonQuery(transaction, sql);
|
||
// if (rows > 0)
|
||
// {
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = "取消组盘成功";
|
||
// OracleHelper.CommitTransaction(transaction);
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = "取消组盘失败";
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
// }
|
||
|
||
|
||
//}
|
||
//#endregion
|
||
//#region 退货码盘入自动化立体库
|
||
//[HttpPost, Route("api/WmsRoallBackInJw")]
|
||
//public HttpResponseMessage WmsRoallBackInJw([FromBody]JObject WmsInvIn)
|
||
//{
|
||
// lock ("WmsRoallBackInJw")
|
||
// {
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", ""),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// string mesJson = WmsInvIn.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收RF退货入库码盘数据:" + mesJson);
|
||
|
||
// OracleTransaction transaction = OracleHelper.BeginTransaction(OracleHelper.RemoteConnectionString);
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string userId = strJo["WmsInvIn"]["userId"].ToString().Trim();//用户id
|
||
// string formId = "JXJWTH";
|
||
// string decid = strJo["WmsInvIn"]["decid"].ToString().Trim();//货位编号
|
||
// string locationId = "";
|
||
// string barcodeListStr = strJo["WmsInvIn"]["BarcodeList"].ToString().Trim();//码盘信息storename
|
||
// DataTable dt = JsonConvert.DeserializeObject<DataTable>(barcodeListStr);
|
||
// string sql = "select STS from T_DECNAME where decid='" + decid + "'";
|
||
// int mode = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sql).ToString());
|
||
// if (mode == 1)
|
||
// {
|
||
// string ctl = "CTL" + DateTime.Now.ToString("yyyymmddhhmmsssss");
|
||
// sql = "select count(*) from T_ONGOODSSHELF where (STORAGE_ID='JXJW' or STORAGE_ID='JXJWTH') and DECID='" + decid + "' and status=1 ";
|
||
// // sql = "select count(*) from T_ONGOODSSHELF where STORAGE_ID='JXJW' and DECID='" + decid + "' and (status=1 or pallet='" + pallet + "') ";
|
||
// int rows = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sql).ToString());
|
||
// if (rows == 0)
|
||
// {
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// for (int i = 0; i < dt.Rows.Count; i++)
|
||
// {
|
||
// string strSql = "select seq_plc_taskval.nextval from dual";
|
||
// string Plcid = OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).ToString();
|
||
|
||
|
||
// string Lotid = "SJ" + DateTime.Now.ToString("yyyymmddhhmmsssss");
|
||
// string outbarcode = dt.Rows[i]["outbarcode"].ToString();
|
||
// sql = "select count(*) from T_ONGOODSSHELF where barcode='" + outbarcode + "'";
|
||
// if (int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sql).ToString()) > 0)
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = outbarcode + "存在库存中";
|
||
|
||
// HttpResponseMessage result1 = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result1;
|
||
// }
|
||
// else
|
||
// {
|
||
// string itmcode = dt.Rows[i]["itmcode"].ToString();
|
||
// string itmversion = dt.Rows[i]["itmversion"].ToString();
|
||
// string itmname = dt.Rows[i]["itmname"].ToString();
|
||
// string datecode = dt.Rows[i]["datecode"].ToString();
|
||
// string storename = dt.Rows[i]["storename"].ToString();
|
||
// string fbgtype = dt.Rows[i]["fbgtype"].ToString();
|
||
// string fgbno = dt.Rows[i]["fgbno"].ToString();
|
||
// string qty = dt.Rows[i]["qty"].ToString();
|
||
// string SqlStr = "insert into T_ONGOODSSHELF(LOT_ID,CTL,GOODSID,STO_NUM,ACC_NUM,SHELF_NUM,STOCK_NUM,Ondate,Onshelfuserid,Storage_Id,STORAGE_AREA_ID,GOODS_MEASURE_ID,Status,barcode,BAOZHIQI,REMARK,LOCATION_ID,TASKTYPE,storage_mode,DECID,PLCID) values('" + Lotid + "','" + ctl + "','" + itmcode + "'," + qty + "," + qty + "," + qty + "," + qty + ",SYSDATE,'" + userId + "','" + formId + "','" + storename + "','" + itmversion + "','0','" + outbarcode + "','" + fbgtype + "','" + datecode + "','" + locationId + "','1','1','" + decid + "','" + Plcid + "')";
|
||
// OracleHelper.ExecuteNonQuery(transaction, SqlStr);
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
|
||
|
||
// string cpj = "";
|
||
// if (decid == "A2")
|
||
// {
|
||
// cpj = "JW-12-40-01";
|
||
// }
|
||
// if (decid == "A3")
|
||
// {
|
||
// cpj = "JW-17-40-01";
|
||
// }
|
||
// JArray ja = new JArray();
|
||
// JObject jo1 = new JObject
|
||
// (
|
||
// new JProperty("taskId", "TRAN" + Guid.NewGuid().ToString()),
|
||
// new JProperty("taskType", "7"),
|
||
// new JProperty("startNode", cpj),
|
||
// new JProperty("endNode", decid),
|
||
// new JProperty("barCode", "1"),
|
||
// new JProperty("order", "0")
|
||
// );
|
||
// ja.Add(jo1);
|
||
// JObject joReturn = new JObject
|
||
// (
|
||
// new JProperty("groupId", "TRAN" + Guid.NewGuid().ToString()),
|
||
// new JProperty("msgTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss")),
|
||
// new JProperty("priorityCode", "1"),
|
||
// new JProperty("district", "JXJW"),
|
||
// new JProperty("tasks", ja)
|
||
// );
|
||
// string strJSONsend = joReturn.ToString();
|
||
// Log.WriteLog(strJSONsend);
|
||
// string errText = "";
|
||
// string resJson = PostJSON("http://10.50.68.61:8082/fromWms/taskReceive", strJSONsend, ref errText);
|
||
// Log.WriteLog("任务接收接口返回JSON:" + resJson);
|
||
// JObject strJo2 = (JObject)JsonConvert.DeserializeObject(resJson);
|
||
// string returnStatus = strJo2["returnStatus"].ToString().Trim();//请求结果
|
||
// string returnInfo = strJo2["returnInfo"].ToString().Trim();//请求结果描述
|
||
// if (returnStatus == "0")//成功
|
||
// {
|
||
|
||
// string SqlStrs = "update T_ONGOODSSHELF set status=1 where ctl='" + ctl + "' ";
|
||
// OracleHelper.ExecuteNonQuery(transaction, SqlStrs);
|
||
// OracleHelper.CommitTransaction(transaction);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = "码盘成功";
|
||
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = "调用WCS接口拆盘接口失败";
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = decid + "有入库任务";
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = decid + "不是入库模式";
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
// }
|
||
|
||
|
||
//}
|
||
//#endregion
|
||
//#region 获取条码信息
|
||
//[HttpGet, Route("api/GetBarcodeInfo")]
|
||
//public HttpResponseMessage GetBarcodeInfo(string Data)
|
||
//{
|
||
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", "S"),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// try
|
||
// {
|
||
|
||
// bool ok = true;
|
||
// string[] datas = Data.Split(',');
|
||
// string Barcode = datas[0];
|
||
// string formId = datas[1];
|
||
// string strSql = "select count(*) from T_ONGOODSSHELF where BARCODE='" + Barcode + "'";
|
||
// int count = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).ToString());
|
||
// if (count > 0)
|
||
// {
|
||
// ok = false;
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = Barcode + "已存在入库任务";
|
||
// }
|
||
// strSql = "select count(*) from T_MI_STOCK where barcode='" + Barcode + "'";
|
||
// count = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).ToString());
|
||
// if (count > 0)
|
||
// {
|
||
// ok = false;
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = Barcode + "已存在库存内";
|
||
// }
|
||
// //访问景旺EBS条码信息
|
||
// if (ok)
|
||
// {
|
||
// string Barcoderesult = "";
|
||
// if (formId == "J02")
|
||
// {
|
||
// Camstar.CamstarSoapClient camstar = new Camstar.CamstarSoapClient();
|
||
// Barcoderesult = camstar.getOutBoxInf(Barcode);
|
||
// }
|
||
// if (formId == "J01")
|
||
// {
|
||
// Camstar1.CamstarSoapClient camstar1 = new Camstar1.CamstarSoapClient();
|
||
// Barcoderesult = camstar1.getOutBoxInf(Barcode);
|
||
// }
|
||
|
||
// Log.WriteLog(Barcoderesult);
|
||
// //Succ:|6000|100|0|0|P3013NLP02074564A|31120170800273-2|BOX|1733||3001|
|
||
|
||
// //string barcodeResult = "Succ:|6000|100|0|0|P3q13NLP02074564A|31120170800273-2|BOX|1733||3001|";
|
||
// string[] sArray = Barcoderesult.Split('|');
|
||
|
||
// //sArray[0];//结果
|
||
// //sArray[1];//查询每包数量
|
||
// //sArray[2];//查询包装数量
|
||
// //sArray[3];//查询包数量,默认为1
|
||
// //sArray[4];//查询零包数量
|
||
// //sArray[5];//查询包装的产品编码
|
||
// //sArray[6];//查询包装销售订单
|
||
// //sArray[7];//查询包装层级,为BOX
|
||
// //sArray[8];//查询周期
|
||
// //sArray[9];//查询客户销售订单
|
||
// //sArray[10];//查询子库
|
||
// //sArray[11];//查询产品名称
|
||
|
||
// if (sArray[0] == "Succ:")
|
||
// {
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = string.Join("|", sArray);
|
||
// Log.WriteLog(string.Join("|", sArray));
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = sArray[0];
|
||
|
||
// }
|
||
// }
|
||
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
//}
|
||
//#endregion
|
||
//#region 获取库存条码信息
|
||
//[HttpGet, Route("api/GetCtlStockInfo")]
|
||
//public HttpResponseMessage GetCtlStockInfo(string Barcode)
|
||
//{
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", "S"),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// try
|
||
// {
|
||
// string strSql = "select * from T_MI_STOCK where BARCODE='" + Barcode + "' ";
|
||
// DataTable dt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).Tables[0];
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// string ctl = dt.Rows[0]["CTL"].ToString();
|
||
// strSql = "select * from T_MI_STOCK where ctl='" + ctl + "' ";
|
||
// dt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).Tables[0];
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = JsonConvert.SerializeObject(dt);
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = Barcode + "不在库存内";
|
||
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = Barcode + "不在库存内";
|
||
// }
|
||
|
||
|
||
|
||
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
//}
|
||
//#endregion
|
||
//#region 获取库存条码信息
|
||
//[HttpGet, Route("api/GetBarcodeStockInfo")]
|
||
//public HttpResponseMessage GetBarcodeStockInfo(string Barcode)
|
||
//{
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", "S"),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// try
|
||
// {
|
||
// string strSql = "select * from T_MI_STOCK where BARCODE='" + Barcode + "' ";
|
||
// DataTable dt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).Tables[0];
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = JsonConvert.SerializeObject(dt);
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = Barcode + "不在库存内";
|
||
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = Barcode + "不在库存内";
|
||
// }
|
||
|
||
|
||
|
||
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
//}
|
||
//#endregion
|
||
//#region 获取出入口模式
|
||
//[HttpGet, Route("api/getpattern")]
|
||
//public HttpResponseMessage getpattern()
|
||
//{
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", "S"),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// try
|
||
// {
|
||
// string strSql = "select decid,sts from T_DECNAME t";
|
||
// DataTable dt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).Tables[0];
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = JsonConvert.SerializeObject(dt);
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = "获取失败";
|
||
// }
|
||
|
||
|
||
|
||
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
//}
|
||
//#endregion
|
||
//#region 修改库口模式
|
||
//[HttpPost, Route("api/updatepattern")]
|
||
//public HttpResponseMessage updatepattern([FromBody]JObject pattren)
|
||
//{
|
||
// lock ("updatepattern")
|
||
// {
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", ""),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// string mesJson = pattren.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收RF入库口模式切换:" + mesJson);
|
||
// OracleTransaction transaction = OracleHelper.BeginTransaction(OracleHelper.RemoteConnectionString);
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string userId = strJo["pattren"]["userId"].ToString().Trim();//用户id
|
||
// string formId = strJo["pattren"]["formId"].ToString().Trim();//组织id
|
||
// string decId = strJo["pattren"]["decId"].ToString().Trim();//设备ID
|
||
// string Sts = strJo["pattren"]["Sts"].ToString().Trim();//状态
|
||
// string sql = "";
|
||
// if (Sts == "0")
|
||
// {
|
||
// sql = "select count(*) from T_ONGOODSSHELF where DECID='" + decId + "'";
|
||
// int rows = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sql).ToString());
|
||
// string sql1 = "select count(*) from T_CK_PICKINGWAVEGOODS where outstand='" + decId + "'";
|
||
// int rows1 = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sql1).ToString());
|
||
// if (rows == 0 && rows1 == 0)
|
||
// {
|
||
|
||
// JObject joReturn = new JObject
|
||
// (
|
||
// new JProperty("fromPort", decId),
|
||
// new JProperty("type", "empty")
|
||
// );
|
||
// string strJSONsend = joReturn.ToString();
|
||
// Log.WriteLog(strJSONsend);
|
||
// string errText = "";
|
||
// string resJson = PostJSON("http://10.50.68.61:8082/fromWms/pattern", strJSONsend, ref errText);
|
||
// Log.WriteLog("任务接收接口返回JSON:" + resJson);
|
||
// JObject strJo2 = (JObject)JsonConvert.DeserializeObject(resJson);
|
||
// string returnStatus = strJo2["returnStatus"].ToString().Trim();//请求结果
|
||
// string returnInfo = strJo2["returnInfo"].ToString().Trim();//请求结果描述
|
||
// if (returnStatus == "0")//成功
|
||
// {
|
||
// sql = "update T_DECNAME set sts=" + Sts + " where DECID='" + decId + "'";
|
||
// OracleHelper.ExecuteNonQuery(transaction, CommandType.Text, sql);
|
||
// OracleHelper.CommitTransaction(transaction);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = decId + "成功修改空托入库模式";
|
||
// }
|
||
// else
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = "调用WCS修改模式接口失败";
|
||
// }
|
||
|
||
|
||
|
||
// }
|
||
// else if (rows > 0)
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = decId + "口,有入库任务,模式修改失败";
|
||
// }
|
||
// else if (rows1 > 0)
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = decId + "口,有出库任务,模式修改失败";
|
||
// }
|
||
|
||
// }
|
||
// if (Sts == "1")
|
||
// {
|
||
// sql = "select count(*) from T_CK_PICKINGWAVEGOODS where outstand='" + decId + "'";
|
||
// int rows = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sql).ToString());
|
||
// if (rows == 0)
|
||
// {
|
||
|
||
|
||
// JObject joReturn = new JObject
|
||
// (
|
||
// new JProperty("fromPort", decId),
|
||
// new JProperty("type", "in")
|
||
// );
|
||
// string strJSONsend = joReturn.ToString();
|
||
// Log.WriteLog(strJSONsend);
|
||
// string errText = "";
|
||
// string resJson = PostJSON("http://10.50.68.61:8082/fromWms/pattern", strJSONsend, ref errText);
|
||
// Log.WriteLog("任务接收接口返回JSON:" + resJson);
|
||
// JObject strJo2 = (JObject)JsonConvert.DeserializeObject(resJson);
|
||
// string returnStatus = strJo2["returnStatus"].ToString().Trim();//请求结果
|
||
// string returnInfo = strJo2["returnInfo"].ToString().Trim();//请求结果描述
|
||
// if (returnStatus == "0")//成功
|
||
// {
|
||
// sql = "update T_DECNAME set sts=" + Sts + " where DECID='" + decId + "'";
|
||
// OracleHelper.ExecuteNonQuery(transaction, CommandType.Text, sql);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = decId + "成功修改入库模式";
|
||
// OracleHelper.CommitTransaction(transaction);
|
||
// }
|
||
// else
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = "调用WCS修改模式接口失败";
|
||
// }
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = decId + "口有出库任务,模式修改失败";
|
||
// }
|
||
// }
|
||
// if (Sts == "2")
|
||
// {
|
||
// sql = "select count(*) from T_ONGOODSSHELF where DECID='" + decId + "'";
|
||
// int rows = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sql).ToString());
|
||
// if (rows == 0)
|
||
// {
|
||
// JObject joReturn = new JObject
|
||
// (
|
||
// new JProperty("fromPort", decId),
|
||
// new JProperty("type", "out")
|
||
// );
|
||
// string strJSONsend = joReturn.ToString();
|
||
// Log.WriteLog(strJSONsend);
|
||
// string errText = "";
|
||
// string resJson = PostJSON("http://10.50.68.61:8082/fromWms/pattern", strJSONsend, ref errText);
|
||
// Log.WriteLog("任务接收接口返回JSON:" + resJson);
|
||
// JObject strJo2 = (JObject)JsonConvert.DeserializeObject(resJson);
|
||
// string returnStatus = strJo2["returnStatus"].ToString().Trim();//请求结果
|
||
// string returnInfo = strJo2["returnInfo"].ToString().Trim();//请求结果描述
|
||
// if (returnStatus == "0")//成功
|
||
// {
|
||
// sql = "update T_DECNAME set sts=" + Sts + " where DECID='" + decId + "'";
|
||
// OracleHelper.ExecuteNonQuery(transaction, CommandType.Text, sql);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = decId + "成功修改出库模式";
|
||
// OracleHelper.CommitTransaction(transaction);
|
||
// }
|
||
// else
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = "调用WCS修改模式接口失败";
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = decId + "口,有入库任务,模式修改失败";
|
||
// }
|
||
// }
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
// }
|
||
|
||
|
||
//}
|
||
//#endregion
|
||
////#region 拣选
|
||
////[HttpGet, Route("api/GetPickingGoods")]
|
||
////public HttpResponseMessage GetPickingGoods(string Barcode)
|
||
////{
|
||
//// JObject jo = new JObject(
|
||
//// new JProperty("STS", "S"),
|
||
//// new JProperty("Result", "")
|
||
//// );
|
||
//// try
|
||
//// {
|
||
//// string strSql = "select * from T_CK_PICKINGWAVEGOODS where CTL='" + Barcode + "'";
|
||
//// DataTable dt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).Tables[0];
|
||
//// if (dt.Rows.Count > 0)
|
||
//// {
|
||
//// jo["STS"] = "S";
|
||
//// jo["Result"] = JsonConvert.SerializeObject(dt);
|
||
//// }
|
||
//// else
|
||
//// {
|
||
//// jo["STS"] = "E";
|
||
//// jo["Result"] = Barcode + "不在库存内";
|
||
|
||
//// }
|
||
|
||
|
||
//// }
|
||
//// catch (Exception ex)
|
||
//// {
|
||
//// jo["STS"] = "E";
|
||
//// jo["Result"] = ex.Message;
|
||
|
||
//// }
|
||
//// HttpResponseMessage result = new HttpResponseMessage
|
||
//// {
|
||
//// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
//// };
|
||
//// return result;
|
||
////}
|
||
////#endregion
|
||
//#region 移库
|
||
//[HttpPost, Route("api/MoveStock")]
|
||
//public HttpResponseMessage MoveStock([FromBody]JObject MoveList)
|
||
//{
|
||
// lock ("MoveStock")
|
||
// {
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", ""),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// List<MovedataModel> movelist = new List<MovedataModel>();
|
||
// string mesJson = MoveList.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收RF移库数据:" + mesJson);
|
||
// OracleTransaction transaction = OracleHelper.BeginTransaction(OracleHelper.RemoteConnectionString);
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string userId = strJo["MoveList"]["userId"].ToString().Trim();//用户id
|
||
// string formId = strJo["MoveList"]["formId"].ToString().Trim();//组织id
|
||
// string locationId = strJo["MoveList"]["LocationId"].ToString().Trim();//货位编号
|
||
// string barcodeListStr = strJo["MoveList"]["BarcodeList"].ToString().Trim();//码盘信息
|
||
// DataTable dt = JsonConvert.DeserializeObject<DataTable>(barcodeListStr);
|
||
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// for (int i = 0; i < dt.Rows.Count; i++)
|
||
// {
|
||
// MovedataModel mm = new MovedataModel();
|
||
// mm.OutBarcode = dt.Rows[i]["BARCODE"].ToString();
|
||
// mm.Location_Id = locationId;
|
||
// mm.Store = "";
|
||
// movelist.Add(mm);
|
||
// string SqlStr = "update T_MI_STOCK set location_id='" + locationId + "',remark='" + userId + "' where barcode='" + mm.OutBarcode + "' and storage_id='" + formId + "' ";
|
||
// OracleHelper.ExecuteNonQuery(transaction, SqlStr);
|
||
// }
|
||
// string[] msg = SaveData(movelist);
|
||
// if (string.Equals(msg[0], "2"))
|
||
// {
|
||
// OracleHelper.CommitTransaction(transaction);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = "移库成功";
|
||
|
||
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = msg[1].ToString();
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = "移库数据错误!";
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
|
||
|
||
// }
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
// }
|
||
|
||
|
||
//}
|
||
//#endregion
|
||
//#region 扫描搬运单
|
||
//[HttpPost, Route("api/GetMoveOrders")]
|
||
//public HttpResponseMessage GetMoveOrders([FromBody]JObject MoveOrder)
|
||
//{
|
||
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", ""),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// string mesJson = MoveOrder.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收扫描搬运单数据:" + mesJson);
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string userId = strJo["MoveOrder"]["userId"].ToString().Trim();//用户id
|
||
// string formId = strJo["MoveOrder"]["formId"].ToString().Trim();//组织id
|
||
// string bydId = strJo["MoveOrder"]["bydId"].ToString().Trim();//搬运单编号
|
||
// if (bydId.IndexOf("-") != -1)
|
||
// {
|
||
// string[] array = bydId.Split('-');
|
||
// string request_number = array[0];
|
||
// string line_numer = array[1];
|
||
// string strSql = "select * from CUX_WMS_MOVE_ORDER_ISSU_ITF t where REQUEST_NUMBER ='" + request_number + "' and LINE_NUMBER='" + line_numer + "' and ORGANIZATION_CODE='" + formId + "' and STATUS=1";
|
||
// Log.WriteLog("sql" + strSql);
|
||
// DataTable dt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).Tables[0];
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = JsonConvert.SerializeObject(dt);
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = "无订单";
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = "搬运单错误";
|
||
// }
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
|
||
//}
|
||
//#endregion
|
||
//#region 挑库出库
|
||
//[HttpPost, Route("api/WmsOutvOut")]
|
||
//public HttpResponseMessage WmsOutvOut([FromBody]JObject WmsOutvOut)
|
||
//{
|
||
// lock ("WmsOutvOut")
|
||
// {
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", ""),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// string mesJson = WmsOutvOut.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收RF挑库数据:" + mesJson);
|
||
// OracleTransaction transaction = OracleHelper.BeginTransaction(OracleHelper.RemoteConnectionString);
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string userId = strJo["WmsOutvOut"]["userId"].ToString().Trim();//用户id
|
||
// string formId = strJo["WmsOutvOut"]["formId"].ToString().Trim();//组织id
|
||
// string locationId = strJo["WmsOutvOut"]["LocationId"].ToString().Trim();//货位编号
|
||
// string barcodeListStr = strJo["WmsOutvOut"]["BarcodeList"].ToString().Trim();//码盘信息
|
||
// DataTable dt = JsonConvert.DeserializeObject<DataTable>(barcodeListStr);
|
||
// decimal sumsty = 0;
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// for (int i = 0; i < dt.Rows.Count; i++)
|
||
// {
|
||
|
||
// string barcode = dt.Rows[i]["BARCODE"].ToString();
|
||
// string strSql = "select * from T_MI_STOCK where barcode='" + barcode + "' and sts=0";
|
||
// DataTable stockDt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).Tables[0];
|
||
// if (stockDt.Rows.Count > 0)
|
||
// {
|
||
// Random dm = new Random();
|
||
// for (int j = 0; j < stockDt.Rows.Count; j++)
|
||
// {
|
||
|
||
// string Lotid = "XJ" + DateTime.Now.ToString("yyyymmddhhmmsssss") + dm.Next();
|
||
// List<MIStockModel> goodsinfo = DataCommon.ConvertHelper<MIStockModel>.ConvertToList(stockDt);
|
||
// sumsty = +goodsinfo[j].SHELVES_NUM;
|
||
// strSql = "insert into T_CK_PICKINGWAVEGOODS(PICKINGID,PUTIN_ID,GOOD_ID,LOC_ID,GOODS_NUM,REMARK,PICKING_NUM,BARCODE,STORAGE_ID,STORAGE_AREA_ID,GOODS_NUM_SJ,STATUS,CK_TYPE,TYPESTS) ";
|
||
// strSql += " values('" + Lotid + "','" + locationId + "','" + goodsinfo[j].GOODS_ID + "','" + goodsinfo[j].LOCATION_ID + "','" + goodsinfo[j].SHELVES_NUM + "','" + goodsinfo[j].REMARK + "','" + goodsinfo[j].SHELVES_NUM + "','" + goodsinfo[j].BARCODE + "','" + goodsinfo[j].STORAGE_ID + "','" + goodsinfo[j].AREA_ID + "','" + goodsinfo[j].SHELVES_NUM + "','0','BYCK','1')";
|
||
|
||
// OracleHelper.ExecuteNonQuery(transaction, strSql);
|
||
// strSql = "update T_MI_STOCK set sts=1 where BARCODE='" + goodsinfo[j].BARCODE + "'";
|
||
// OracleHelper.ExecuteNonQuery(transaction, strSql);
|
||
// }
|
||
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = barcode + "不在库存内";
|
||
// }
|
||
// }
|
||
// if (locationId.IndexOf("-") != -1)
|
||
// {
|
||
// string[] array = locationId.Split('-');
|
||
// string request_number = array[0];
|
||
// string line_numer = array[1];
|
||
// string strSql = "update cux_wms_move_order_issu_itf set status=2,QUANTITY_DELIVERED=" + sumsty + " where request_number='" + request_number + "' and line_number='" + line_numer + "'";
|
||
// OracleHelper.ExecuteNonQuery(transaction, strSql);
|
||
// OracleHelper.CommitTransaction(transaction);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = "挑货成功";
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = "搬运单错误";
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
|
||
|
||
// }
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
// }
|
||
|
||
|
||
//}
|
||
//#endregion
|
||
//#region 扫描返修单
|
||
//[HttpPost, Route("api/GetFxOrders")]
|
||
//public HttpResponseMessage GetFxOrders([FromBody]JObject FxOrders)
|
||
//{
|
||
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", ""),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// string mesJson = FxOrders.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收扫描搬运单数据:" + mesJson);
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string userId = strJo["FxOrders"]["userId"].ToString().Trim();//用户id
|
||
// string formId = strJo["FxOrders"]["formId"].ToString().Trim();//组织id
|
||
// string fixid = strJo["FxOrders"]["fixid"].ToString().Trim();//搬运单编号
|
||
// string strSql = "select * from cux_wms_fix_issue_itf where wip_entity_id='" + fixid + "' and organization_code='" + formId + "' and STATUS=1";
|
||
// DataTable dt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).Tables[0];
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = JsonConvert.SerializeObject(dt);
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = "无订单";
|
||
// }
|
||
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
|
||
//}
|
||
//#endregion
|
||
//#region 返修出库
|
||
//[HttpPost, Route("api/WMSFixOut")]
|
||
//public HttpResponseMessage WMSFixOut([FromBody]JObject WMSFixOut)
|
||
//{
|
||
// lock ("WMSFixOut")
|
||
// {
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", ""),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// string mesJson = WMSFixOut.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收返修出库数据:" + mesJson);
|
||
// OracleTransaction transaction = OracleHelper.BeginTransaction(OracleHelper.RemoteConnectionString);
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string userId = strJo["WMSFixOut"]["userId"].ToString().Trim();//用户id
|
||
// string formId = strJo["WMSFixOut"]["formId"].ToString().Trim();//组织id
|
||
// string locationId = strJo["WMSFixOut"]["LocationId"].ToString().Trim();//货位编号
|
||
// string barcodeListStr = strJo["WMSFixOut"]["BarcodeList"].ToString().Trim();//码盘信息
|
||
// DataTable dt = JsonConvert.DeserializeObject<DataTable>(barcodeListStr);
|
||
// decimal sumsty = 0;
|
||
// string strSql = string.Empty;
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// for (int i = 0; i < dt.Rows.Count; i++)
|
||
// {
|
||
// string Lotid = "XJ" + DateTime.Now.ToString("yyyymmddhhmmsssss");
|
||
// string barcode = dt.Rows[i]["BARCODE"].ToString();
|
||
// strSql = "select * from T_MI_STOCK where barcode='" + barcode + "' and sts=0";
|
||
// DataTable stockDt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).Tables[0];
|
||
// if (stockDt.Rows.Count > 0)
|
||
// {
|
||
// for (int j = 0; j < stockDt.Rows.Count; j++)
|
||
// {
|
||
// List<MIStockModel> goodsinfo = DataCommon.ConvertHelper<MIStockModel>.ConvertToList(stockDt);
|
||
// sumsty = +goodsinfo[j].SHELVES_NUM;
|
||
// strSql = "insert into T_CK_PICKINGWAVEGOODS(PICKINGID,PUTIN_ID,GOOD_ID,LOC_ID,GOODS_NUM,REMARK,PICKING_NUM,BARCODE,STORAGE_ID,STORAGE_AREA_ID,GOODS_NUM_SJ,STATUS,CK_TYPE,TYPESTS,CUSTOMERMEMBERID) ";
|
||
// strSql += " values('" + Lotid + "','" + locationId + "','" + goodsinfo[j].GOODS_ID + "','" + goodsinfo[j].LOCATION_ID + "','" + goodsinfo[j].SHELVES_NUM + "','" + goodsinfo[j].REMARK + "','" + goodsinfo[j].SHELVES_NUM + "','" + goodsinfo[j].BARCODE + "','" + goodsinfo[j].STORAGE_ID + "','" + goodsinfo[j].AREA_ID + "','" + goodsinfo[j].SHELVES_NUM + "','2','FXCK','2','" + userId + "')";
|
||
|
||
// OracleHelper.ExecuteNonQuery(transaction, strSql);
|
||
// strSql = "update T_MI_STOCK set sts=1 where BARCODE='" + goodsinfo[j].BARCODE + "'";
|
||
// OracleHelper.ExecuteNonQuery(transaction, strSql);
|
||
// }
|
||
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = barcode + "不在库存内";
|
||
// }
|
||
// }
|
||
// strSql = "update cux_wms_fix_issue_itf set status=1 where wip_entity_id='" + locationId + "' and organization_code='" + formId + "'";
|
||
// OracleHelper.ExecuteNonQuery(transaction, strSql);
|
||
// OracleHelper.CommitTransaction(transaction);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = "返修成功";
|
||
|
||
|
||
|
||
// }
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
// }
|
||
|
||
|
||
//}
|
||
//#endregion
|
||
//#region 获取拣货信息
|
||
//[HttpPost, Route("api/GetPickingGoods")]
|
||
//public HttpResponseMessage GetPickingGoods([FromBody]JObject Data)
|
||
//{
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", "S"),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// string mesJson = Data.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收RF挑库数据:" + mesJson);
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string userId = strJo["Data"]["userId"].ToString().Trim();//用户id
|
||
// string formId = strJo["Data"]["formId"].ToString().Trim();//组织id
|
||
// string decId = strJo["Data"]["DecId"].ToString().Trim();//设备编号
|
||
// string typeSts = strJo["Data"]["TYPESTS"].ToString().Trim();//出库类型
|
||
// string STS = strJo["Data"]["STS"].ToString().Trim();//WCS报完成 拣选状态是3 追加状态是4
|
||
// string strSql = "select * from T_CK_PICKINGWAVEGOODS where OUTSTAND='" + decId + "' and TYPESTS='" + typeSts + "' and STATUS='" + STS + "'";
|
||
|
||
// DataTable dt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).Tables[0];
|
||
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// string ctl = dt.Rows[0]["ctl"].ToString();
|
||
// int shelves_num = 0;
|
||
// if (typeSts == "7")
|
||
// {
|
||
// strSql = "select count(*) as shelves_num from T_MI_STOCK where ctl='" + ctl + "'";
|
||
// shelves_num = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).ToString());
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = "[{ \"CTL\":\"" + ctl + "\",\"SHELVES_NUM\":\"" + shelves_num + "\"}]";
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = JsonConvert.SerializeObject(dt);
|
||
// }
|
||
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = decId + "口,没有拣选或追加任务";
|
||
// }
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
//}
|
||
//#endregion
|
||
//#region 拣选回库处理
|
||
//[HttpPost, Route("api/JxRollBackhandle")]
|
||
//public HttpResponseMessage JxRollBackhandle([FromBody]JObject Data)
|
||
//{
|
||
// lock ("JxRollBackhandle")
|
||
// {
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", "S"),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// string mesJson = Data.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收RF拣选数据:" + mesJson);
|
||
// OracleTransaction transaction = OracleHelper.BeginTransaction(OracleHelper.RemoteConnectionString);
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string userId = strJo["WmsInvIn"]["userId"].ToString().Trim();//用户id
|
||
// string formId = strJo["WmsInvIn"]["formId"].ToString().Trim();//组织id
|
||
// string decId = strJo["WmsInvIn"]["DecId"].ToString().Trim();//设备编号
|
||
// string tableList = strJo["WmsInvIn"]["tableList"].ToString().Trim();//条码数据
|
||
// DataTable dt = JsonConvert.DeserializeObject<DataTable>(tableList);
|
||
// List<MIStockModel> goodsinfo = DataCommon.ConvertHelper<MIStockModel>.ConvertToList(dt);
|
||
// string sqlStr = "";
|
||
// string ctl = "";
|
||
// int rows = 0;
|
||
// if (goodsinfo.Count > 0)
|
||
// {
|
||
// ctl = goodsinfo[0].CTL;
|
||
|
||
// foreach (var item in goodsinfo)
|
||
// {
|
||
// string Lotid = "XJ" + DateTime.Now.ToString("yyyymmddhhmmsssss");
|
||
// string barcode = item.BARCODE;
|
||
// //sqlStr = "select count(*) from T_CK_PICKINGWAVEGOODS where barcode='" + barcode + "' and TYPESTS!=7";
|
||
// //rows = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sqlStr).ToString());
|
||
// //if (rows == 0)
|
||
// //{
|
||
// sqlStr = "insert into T_CK_PICKINGWAVEGOODS(PICKINGID,PUTIN_ID,GOOD_ID,LOC_ID,GOODS_NUM,REMARK,PICKING_NUM,BARCODE,STORAGE_ID,STORAGE_AREA_ID,GOODS_NUM_SJ,STATUS,CK_TYPE,TYPESTS,CTL,OUTSTAND) ";
|
||
// sqlStr += " values('" + Guid.NewGuid().ToString() + "','" + Guid.NewGuid().ToString() + "','" + item.GOODS_ID + "','" + item.LOCATION_ID + "','" + item.SHELVES_NUM + "','" + item.REMARK + "','" + item.SHELVES_NUM + "','" + item.BARCODE + "','" + item.STORAGE_ID + "','" + item.AREA_ID + "','" + item.SHELVES_NUM + "','0','JX','1','" + item.CTL + "','" + decId + "')";
|
||
// Log.WriteLog(sqlStr);
|
||
|
||
// OracleHelper.ExecuteNonQuery(transaction, sqlStr);
|
||
|
||
// //}
|
||
// //else
|
||
// //{
|
||
// // jo["STS"] = "E";
|
||
// // jo["Result"] = "该条码已经存在拣选任务列表中";
|
||
// // transaction.Rollback();
|
||
// // break;
|
||
|
||
// //}
|
||
|
||
// }
|
||
// transaction.Commit();
|
||
// transaction = OracleHelper.BeginTransaction(OracleHelper.RemoteConnectionString);
|
||
// sqlStr = "select * from T_MI_STOCK where barcode not in (select barcode from T_CK_PICKINGWAVEGOODS where ctl='" + ctl + "' and typests!=7 ) and ctl='" + ctl + "'";
|
||
// Log.WriteLog(sqlStr);
|
||
// DataTable StockDt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, sqlStr).Tables[0];
|
||
// goodsinfo = DataCommon.ConvertHelper<MIStockModel>.ConvertToList(StockDt);
|
||
// sqlStr = "select seq_plc_taskval.nextval from dual";
|
||
// Log.WriteLog(sqlStr);
|
||
// string Plcid = OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sqlStr).ToString();
|
||
// foreach (var item in goodsinfo)
|
||
// {
|
||
// string Lotid = "SJ" + DateTime.Now.ToString("yyyymmddhhmmsssss");
|
||
// string outbarcode = item.BARCODE;
|
||
// string itmcode = item.GOODS_ID;
|
||
// string itmversion = "";
|
||
// //string itmname = dt.Rows[i]["itmname"].ToString();
|
||
// string datecode = item.REMARK;
|
||
// string storage_id = "JXJW";
|
||
// string storename = item.AREA_ID;
|
||
// string fbgtype = "";
|
||
|
||
// // string fgbno = dt.Rows[i]["fgbno"].ToString();
|
||
// string qty = item.SHELVES_NUM.ToString();
|
||
// string SqlStr = "insert into T_ONGOODSSHELF(LOT_ID,GOODSID,STO_NUM,ACC_NUM,SHELF_NUM,STOCK_NUM,Ondate,Onshelfuserid,Storage_Id,STORAGE_AREA_ID,GOODS_MEASURE_ID,Status,barcode,BAOZHIQI,REMARK,DECID,TASKTYPE,CTL,PLCID) values('" + Lotid + "','" + itmcode + "'," + qty + "," + qty + "," + qty + "," + qty + ",SYSDATE,'" + userId + "','" + storage_id + "','" + storename + "','" + itmversion + "','1','" + outbarcode + "','" + fbgtype + "','" + datecode + "','" + decId + "','1','" + ctl + "','" + Plcid + "')";
|
||
// OracleHelper.ExecuteNonQuery(transaction, SqlStr);
|
||
// Log.WriteLog(sqlStr);
|
||
|
||
// }
|
||
// sqlStr = "update T_CK_PICKINGWAVEGOODS set status=2 where ctl='" + ctl + "' and typests='7' and status='3' and outstand='" + decId + "'";
|
||
// Log.WriteLog(sqlStr);
|
||
// rows = OracleHelper.ExecuteNonQuery(transaction, sqlStr);
|
||
// if (rows > 0)
|
||
// {
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = "拣选成功";
|
||
|
||
// transaction.Commit();
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = "拣选失败";
|
||
|
||
// transaction.Rollback();
|
||
|
||
|
||
// }
|
||
|
||
|
||
|
||
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = "数据异常:没有条码数据";
|
||
// transaction.Rollback();
|
||
// }
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
// Log.WriteLog("接收RF拣选任务发生异常"+ex.Message);
|
||
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
// }
|
||
|
||
//}
|
||
//#endregion
|
||
//#region 追加回库处理
|
||
//[HttpPost, Route("api/JxAddhandle")]
|
||
//public HttpResponseMessage JxAddhandle([FromBody]JObject Data)
|
||
//{
|
||
// lock ("JxAddhandle")
|
||
// {
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", "S"),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// string mesJson = Data.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收RF拣选数据:" + mesJson);
|
||
// OracleTransaction transaction = OracleHelper.BeginTransaction(OracleHelper.RemoteConnectionString);
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string userId = strJo["Data"]["userId"].ToString().Trim();//用户id
|
||
// string formId = strJo["Data"]["formId"].ToString().Trim();//组织id
|
||
// string decId = strJo["Data"]["DecId"].ToString().Trim();//设备编号
|
||
// string tableList = strJo["Data"]["tableList"].ToString().Trim();//条码数据
|
||
// DataTable dt = JsonConvert.DeserializeObject<DataTable>(tableList);
|
||
// List<MIStockModel> goodsinfo = DataCommon.ConvertHelper<MIStockModel>.ConvertToList(dt);
|
||
// string sqlStr = "";
|
||
// string ctl = "";
|
||
// int rows = 0;
|
||
// if (goodsinfo.Count > 0)
|
||
// {
|
||
// ctl = goodsinfo[0].CTL;
|
||
// sqlStr = "select seq_plc_taskval.nextval from dual";
|
||
// string Plcid = OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sqlStr).ToString();
|
||
// foreach (var item in goodsinfo)
|
||
// {
|
||
// string Lotid = "SJ" + DateTime.Now.ToString("yyyymmddhhmmsssss");
|
||
// string outbarcode = item.BARCODE;
|
||
// string itmcode = item.GOODS_ID;
|
||
// string itmversion = "";
|
||
// //string itmname = dt.Rows[i]["itmname"].ToString();
|
||
// string datecode = item.REMARK;
|
||
// formId = "JXJW";
|
||
// string storename = item.AREA_ID;
|
||
// string fbgtype = "";
|
||
|
||
// // string fgbno = dt.Rows[i]["fgbno"].ToString();
|
||
// string qty = item.SHELVES_NUM.ToString();
|
||
// string SqlStr = "insert into T_ONGOODSSHELF(LOT_ID,GOODSID,STO_NUM,ACC_NUM,SHELF_NUM,STOCK_NUM,Ondate,Onshelfuserid,Storage_Id,STORAGE_AREA_ID,GOODS_MEASURE_ID,Status,barcode,BAOZHIQI,REMARK,DECID,TASKTYPE,CTL,PLCID) values('" + Lotid + "','" + itmcode + "'," + qty + "," + qty + "," + qty + "," + qty + ",SYSDATE,'" + userId + "','" + formId + "','" + storename + "','" + itmversion + "','1','" + outbarcode + "','" + fbgtype + "','" + datecode + "','" + decId + "','1','" + ctl + "','" + Plcid + "')";
|
||
// OracleHelper.ExecuteNonQuery(transaction, SqlStr);
|
||
|
||
// }
|
||
// sqlStr = "update T_CK_PICKINGWAVEGOODS set status=2 where ctl='" + ctl + "' and typests='8' and status='4' and outstand='" + decId + "'";
|
||
// rows = OracleHelper.ExecuteNonQuery(transaction, sqlStr);
|
||
// if (rows > 0)
|
||
// {
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = "追加成功";
|
||
// transaction.Commit();
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = "追加失败";
|
||
// transaction.Rollback();
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = "数据异常:没有条码数据";
|
||
// transaction.Rollback();
|
||
// }
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
// transaction.Rollback();
|
||
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
// }
|
||
|
||
//}
|
||
//#endregion
|
||
//#region 报废
|
||
//[HttpPost, Route("api/WMSMoveBf")]
|
||
//public HttpResponseMessage WMSMoveBf([FromBody]JObject WMSMoveBf)
|
||
//{
|
||
|
||
// JObject jo = new JObject(
|
||
// new JProperty("STS", ""),
|
||
// new JProperty("Result", "")
|
||
// );
|
||
// string mesJson = WMSMoveBf.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收报废数据:" + mesJson);
|
||
// OracleTransaction transaction = OracleHelper.BeginTransaction(OracleHelper.RemoteConnectionString);
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string userId = strJo["WMSMoveBf"]["userId"].ToString().Trim();//用户id
|
||
// string formId = strJo["WMSMoveBf"]["formId"].ToString().Trim();//组织id
|
||
// //string locationId = strJo["WMSMoveBf"]["LocationId"].ToString().Trim();//货位编号
|
||
// string barcodeListStr = strJo["WMSMoveBf"]["BarcodeList"].ToString().Trim();//码盘信息
|
||
// DataTable dt = JsonConvert.DeserializeObject<DataTable>(barcodeListStr);
|
||
// decimal sumsty = 0;
|
||
// string strSql = string.Empty;
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// for (int i = 0; i < dt.Rows.Count; i++)
|
||
// {
|
||
// string Lotid = "XJ" + DateTime.Now.ToString("yyyymmddhhmmsssss");
|
||
// string barcode = dt.Rows[i]["BARCODE"].ToString();
|
||
// string[] msg = SaveData(barcode);
|
||
// if (string.Equals(msg[0], "2"))
|
||
// {
|
||
// Log.WriteLog("1");
|
||
// strSql = "select * from T_MI_STOCK where barcode='" + barcode + "' and sts=0";
|
||
// DataTable stockDt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).Tables[0];
|
||
// if (stockDt.Rows.Count > 0)
|
||
// {
|
||
// for (int j = 0; j < stockDt.Rows.Count; j++)
|
||
// {
|
||
// List<MIStockModel> goodsinfo = DataCommon.ConvertHelper<MIStockModel>.ConvertToList(stockDt);
|
||
// sumsty = +goodsinfo[i].SHELVES_NUM;
|
||
// strSql = "insert into T_CK_PICKINGWAVEGOODS(PICKINGID,PUTIN_ID,GOOD_ID,LOC_ID,GOODS_NUM,REMARK,PICKING_NUM,BARCODE,STORAGE_ID,STORAGE_AREA_ID,GOODS_NUM_SJ,STATUS,CK_TYPE,TYPESTS,CUSTOMERMEMBERID) ";
|
||
// strSql += " values('" + Lotid + "','" + goodsinfo[j].LOCATION_ID + "','" + goodsinfo[j].GOODS_ID + "','" + goodsinfo[j].LOCATION_ID + "','" + goodsinfo[j].SHELVES_NUM + "','" + goodsinfo[j].REMARK + "','" + goodsinfo[j].SHELVES_NUM + "','" + goodsinfo[j].BARCODE + "','" + goodsinfo[j].STORAGE_ID + "','" + goodsinfo[j].AREA_ID + "','" + goodsinfo[j].SHELVES_NUM + "','2','BFCK','2','" + userId + "')";
|
||
|
||
// OracleHelper.ExecuteNonQuery(transaction, strSql);
|
||
// strSql = "update T_MI_STOCK set sts=1 where BARCODE='" + goodsinfo[j].BARCODE + "'";
|
||
// OracleHelper.ExecuteNonQuery(transaction, strSql);
|
||
// }
|
||
// OracleHelper.CommitTransaction(transaction);
|
||
// jo["STS"] = "S";
|
||
// jo["Result"] = "报废成功";
|
||
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// jo["STS"] = "F";
|
||
// jo["Result"] = barcode + "不在库存内 无需报废";
|
||
// }
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// jo["STS"] = "F";
|
||
// jo["Result"] = barcode + "请求EBS报废失败" + msg[1].ToString();
|
||
|
||
// }
|
||
|
||
|
||
// }
|
||
|
||
// }
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["STS"] = "E";
|
||
// jo["Result"] = ex.Message;
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
|
||
//}
|
||
//#endregion
|
||
//#region 移库信息xml
|
||
//string SetXmlData(List<MovedataModel> mvdt)
|
||
//{
|
||
// string UsernameToken = ConfigurationManager.AppSettings["UsernameToken"].ToString(); ;
|
||
// string PasswordToken = ConfigurationManager.AppSettings["PasswordToken"].ToString(); ;
|
||
// string xml = "";
|
||
// xml += "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:cux=\"http://xmlns.oracle.com/apps/cux/soaprovider/plsql/cux_dely_ws_pda_api/\" xmlns:call=\"http://xmlns.oracle.com/apps/cux/soaprovider/plsql/cux_dely_ws_pda_api/call_procedure/\">";
|
||
// xml += "<soapenv:Header>";
|
||
// xml += "<cux:SOAHeader><cux:NLSLanguage>SIMPLIFIED CHINESE</cux:NLSLanguage></cux:SOAHeader>";
|
||
// xml += "<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" mustUnderstand=\"1\">";
|
||
// xml += "<wsse:UsernameToken>";
|
||
// xml += "<wsse:Username>" + UsernameToken + "</wsse:Username>";
|
||
// xml += "<wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">" + PasswordToken + "</wsse:Password>";
|
||
// xml += "</wsse:UsernameToken></wsse:Security>";
|
||
// xml += "</soapenv:Header>";
|
||
// xml += "<soapenv:Body>";
|
||
// xml += "<call:InputParameters>";
|
||
|
||
// xml += "<!--Optional:-->";
|
||
// xml += "<call:P_DATA_TBL>";
|
||
|
||
// foreach (MovedataModel md in mvdt)
|
||
// {
|
||
|
||
// xml += "<!--Zero or more repetitions:-->";
|
||
// xml += "<call:P_DATA_TBL_ITEM>";
|
||
// xml += "<!--Optional:-->";
|
||
// xml += "<call:OUT_BAR_CODE>" + md.OutBarcode + "</call:OUT_BAR_CODE>";
|
||
// xml += "<!--Optional:-->";
|
||
// xml += "<call:SUBINVENTORY_CODE>" + md.Store + "</call:SUBINVENTORY_CODE>";
|
||
// xml += "<!--Optional:-->";
|
||
// xml += "<call:LOCATION_CODE>" + md.Location_Id + "</call:LOCATION_CODE>";
|
||
// xml += "</call:P_DATA_TBL_ITEM>";
|
||
// }
|
||
|
||
|
||
// xml += "</call:P_DATA_TBL>";
|
||
// xml += "<!--Optional:-->";
|
||
// xml += "<call:P_PROCEDURE_NAME>SUBINV_TRANSFER_MAIN</call:P_PROCEDURE_NAME>";
|
||
// xml += "</call:InputParameters>";
|
||
// xml += "</soapenv:Body>";
|
||
// xml += "</soapenv:Envelope>";
|
||
|
||
|
||
|
||
// return xml;
|
||
|
||
//}
|
||
|
||
//#endregion
|
||
//#region 报废信息发送
|
||
//private string[] SaveData(string _barcode)
|
||
//{
|
||
// Log.WriteLog("2");
|
||
// string str_xml = SetXmlData(_barcode);
|
||
// string url = "http://kwuat.kinwong.com:8000/webservices/SOAProvider/plsql/cux_dely_ws_pda_api/?wsdl";
|
||
// string method = "CALL_PROCEDURE";
|
||
// try
|
||
// {
|
||
// str_xml = getXmlData(url, str_xml, method);
|
||
// XmlDocument doc = new XmlDocument();
|
||
// doc.LoadXml(str_xml);
|
||
|
||
// XmlElement root = doc.DocumentElement;
|
||
// string nameSpace = root.NamespaceURI;
|
||
// XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
|
||
// nsmgr.AddNamespace("env", nameSpace);
|
||
// nsmgr.AddNamespace("ns1", "http://xmlns.oracle.com/apps/cux/soaprovider/plsql/cux_dely_ws_pda_api/call_procedure/");
|
||
// string xpath = "/env:Envelope/env:Body/ns1:OutputParameters";
|
||
// XmlNode xn = doc.DocumentElement.SelectSingleNode(xpath, nsmgr);
|
||
// System.Collections.Generic.Dictionary<string, string> Msg = new Dictionary<string, string>();
|
||
// foreach (XmlElement a in xn.ChildNodes)
|
||
// {
|
||
// Msg.Add(a.Name, a.InnerText);
|
||
|
||
// }
|
||
|
||
// return new string[2] { Msg["X_RETURN_CODE"], Msg["X_MSG_DATA"] };
|
||
// Log.WriteLog("3");
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// throw new Exception(ex.Message);
|
||
// }
|
||
|
||
//}
|
||
|
||
//#endregion
|
||
//#region 移库信息发送
|
||
|
||
//private string[] SaveData(List<MovedataModel> _movedata)
|
||
//{
|
||
|
||
// string str_xml = SetXmlData(_movedata); ;
|
||
// string url = ConfigurationManager.AppSettings["EbsBfUrl"];
|
||
// string method = "CALL_PROCEDURE";
|
||
// try
|
||
// {
|
||
// str_xml = getXmlData(url, str_xml, method);
|
||
// XmlDocument doc = new XmlDocument();
|
||
// doc.LoadXml(str_xml);
|
||
|
||
// XmlElement root = doc.DocumentElement;
|
||
// string nameSpace = root.NamespaceURI;
|
||
// XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
|
||
// nsmgr.AddNamespace("env", nameSpace);
|
||
// nsmgr.AddNamespace("ns1", "http://xmlns.oracle.com/apps/cux/soaprovider/plsql/cux_dely_ws_pda_api/call_procedure/");
|
||
// string xpath = "/env:Envelope/env:Body/ns1:OutputParameters";
|
||
// XmlNode xn = doc.DocumentElement.SelectSingleNode(xpath, nsmgr);
|
||
// System.Collections.Generic.Dictionary<string, string> Msg = new Dictionary<string, string>();
|
||
// foreach (XmlElement a in xn.ChildNodes)
|
||
// {
|
||
// Msg.Add(a.Name, a.InnerText);
|
||
|
||
// }
|
||
|
||
// return new string[2] { Msg["X_RETURN_CODE"], Msg["X_MSG_DATA"] };
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// throw new Exception(ex.Message);
|
||
// }
|
||
|
||
//}
|
||
//#endregion
|
||
//#region 报废信息xml
|
||
//string SetXmlData(string _barcode)
|
||
//{
|
||
// string UsernameToken = "OA";
|
||
// string PasswordToken = "12345678";
|
||
// string xml = "";
|
||
// xml += "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:cux=\"http://xmlns.oracle.com/apps/cux/soaprovider/plsql/cux_dely_ws_pda_api/\" xmlns:call=\"http://xmlns.oracle.com/apps/cux/soaprovider/plsql/cux_dely_ws_pda_api/call_procedure/\">";
|
||
// xml += "<soapenv:Header>";
|
||
// xml += "<cux:SOAHeader><cux:NLSLanguage>SIMPLIFIED CHINESE</cux:NLSLanguage></cux:SOAHeader>";
|
||
// xml += "<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" mustUnderstand=\"1\">";
|
||
// xml += "<wsse:UsernameToken>";
|
||
// xml += "<wsse:Username>" + UsernameToken + "</wsse:Username>";
|
||
// xml += "<wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">" + PasswordToken + "</wsse:Password>";
|
||
// xml += "</wsse:UsernameToken></wsse:Security>";
|
||
// xml += "</soapenv:Header>";
|
||
// xml += "<soapenv:Body>";
|
||
// xml += "<call:InputParameters>";
|
||
// xml += "<!--Optional:-->";
|
||
// xml += "<call:P_DATA_TBL>";
|
||
// xml += "<!--Zero or more repetitions:-->";
|
||
// xml += "<call:P_DATA_TBL_ITEM>";
|
||
// xml += "<!--Optional:-->";
|
||
// xml += "<call:OUT_BAR_CODE>" + _barcode + "</call:OUT_BAR_CODE>";
|
||
// xml += "</call:P_DATA_TBL_ITEM>";
|
||
// xml += "</call:P_DATA_TBL>";
|
||
// xml += "<!--Optional:-->";
|
||
// xml += "<call:P_PROCEDURE_NAME>MISC_OUTBOUND_MAIN</call:P_PROCEDURE_NAME>";
|
||
// xml += "</call:InputParameters>";
|
||
// xml += "</soapenv:Body>";
|
||
// xml += "</soapenv:Envelope>";
|
||
// return xml;
|
||
|
||
//}
|
||
//#endregion
|
||
//#region 调用EBS Webservice 反馈报废和移库信息
|
||
//public static string getXmlData(string url, string xml, string method)
|
||
//{
|
||
|
||
// try
|
||
// {
|
||
|
||
// HttpWebRequest req = (HttpWebRequest)WebRequest.Create(String.Format("{0}/{1}", url, method));
|
||
// req.Headers.Add("SOAPAction", url);
|
||
// req.ContentType = "text/xml;charset=\"utf-8\"";
|
||
// req.Accept = "text/xml";
|
||
// req.Method = "POST";
|
||
// //是否和请求一起发送
|
||
|
||
// //req.UseDefaultCredentials = true;
|
||
// req.AllowWriteStreamBuffering = true;
|
||
|
||
|
||
// //写数据信息的流对象
|
||
|
||
// using (StreamWriter swMessages = new StreamWriter(req.GetRequestStream()))
|
||
// {
|
||
|
||
// //写入的流以XMl格式写入
|
||
|
||
// swMessages.Write(xml);
|
||
// swMessages.Flush();
|
||
|
||
// //关闭写入流
|
||
|
||
// swMessages.Close();
|
||
|
||
// }
|
||
|
||
// HttpWebResponse res;
|
||
|
||
// try
|
||
// {
|
||
|
||
// res = (HttpWebResponse)req.GetResponse();
|
||
|
||
// }
|
||
|
||
// catch (WebException ex)
|
||
// {
|
||
|
||
// res = (HttpWebResponse)ex.Response;
|
||
// throw new Exception(ex.Message);
|
||
|
||
// }
|
||
|
||
// StreamReader sr = new StreamReader(res.GetResponseStream(), Encoding.GetEncoding("utf-8"));
|
||
|
||
// String strHtml = sr.ReadToEnd();
|
||
// sr.Close();
|
||
|
||
// return strHtml;
|
||
|
||
// }
|
||
|
||
// catch (Exception e)
|
||
// {
|
||
// throw new Exception(e.ToString());
|
||
|
||
// }
|
||
|
||
//}
|
||
|
||
//#endregion
|
||
//#region 接收WCS任务状态信息 上报
|
||
///// <summary>
|
||
///// 接收WCS任务状态信息
|
||
///// </summary>
|
||
///// <returns></returns>]
|
||
//[HttpPost, Route("wms/executionPhase")]
|
||
//public HttpResponseMessage GetTaskFinishData([FromBody]JObject WmsInvIn)
|
||
//{
|
||
// string errText = string.Empty;
|
||
// ArrayList SqlList = new ArrayList();
|
||
// string mesJson = WmsInvIn.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// T_Stock_InRequest.ReturnErrorData reerrdata = new T_Stock_InRequest.ReturnErrorData();
|
||
// Log.WriteLog("接收WCS任务状态信息:" + mesJson);
|
||
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string taskId = strJo["taskId"].ToString().Trim();//任务编号
|
||
// string reportTime = strJo["reportTime"].ToString().Trim();//上报时间
|
||
// string taskStatus = strJo["taskStatus"].ToString().Trim();//任务状态
|
||
// // string reporInfo = strJo["reporInfo"].ToString().Trim();//异常原因
|
||
// string sts = "";
|
||
// switch (taskStatus)
|
||
// {
|
||
// case "0":
|
||
// sts = "4"; //任务接收
|
||
// break;
|
||
// case "1":
|
||
// sts = "5"; //任务开始
|
||
// break;
|
||
// case "7":
|
||
// sts = "6"; //任务中断
|
||
// break;
|
||
// case "8":
|
||
// sts = "8"; //任务结束
|
||
// break;
|
||
// default:
|
||
// sts = "9"; //默认配置
|
||
// break;
|
||
|
||
// }
|
||
// //更新入库出库表
|
||
|
||
|
||
// if (sts == "8")
|
||
// {
|
||
// sts = "2";
|
||
// }
|
||
// int Ckflag = 0;
|
||
// int Rkflag = 0;
|
||
// string sqlStr = "select * from T_CK_PICKINGWAVEGOODS where plcid='" + taskId + "' ";
|
||
// DataTable dt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, sqlStr).Tables[0];
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// string TYPESTS = dt.Rows[0]["TYPESTS"].ToString();
|
||
// if (TYPESTS == "7")
|
||
// {
|
||
// sts = "3";
|
||
// }
|
||
// if (TYPESTS == "8")
|
||
// {
|
||
// sts = "4";
|
||
// }
|
||
// string strSql = "update T_CK_PICKINGWAVEGOODS set status='" + sts + "' where plcid='" + taskId + "'";
|
||
// Ckflag = OracleHelper.ExecuteNonQuery(OracleHelper.RemoteConnectionString, CommandType.Text, strSql);
|
||
// }
|
||
// sqlStr = "select * from T_ONGOODSSHELF where plcid='" + taskId + "'";
|
||
// dt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, sqlStr).Tables[0];
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// string strSql1 = "update T_ONGOODSSHELF set status='" + sts + "' where plcid='" + taskId + "'";
|
||
|
||
// Rkflag = OracleHelper.ExecuteNonQuery(OracleHelper.RemoteConnectionString, CommandType.Text, strSql1);
|
||
// }
|
||
|
||
|
||
|
||
// if (errText.Length == 0)
|
||
// {
|
||
// if (Ckflag > 0 || Rkflag > 0)
|
||
// {
|
||
// reerrdata.returnInfo = "";
|
||
// reerrdata.returnStatus = "0";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// else
|
||
// {
|
||
// reerrdata.returnInfo = "无效入出库订单号";
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// reerrdata.returnInfo = errText;
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// Log.WriteLog("接收WCS任务状态反馈数据异常" + ex.Message.ToString());
|
||
// reerrdata.returnInfo = ex.Message.ToString();
|
||
// reerrdata.returnStatus = "0";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
|
||
// }
|
||
|
||
// string strJson2 = JsonConvert.SerializeObject(reerrdata);
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(strJson2, System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
|
||
|
||
//}
|
||
//#endregion
|
||
//#region 接收WCS反馈入库口货物高度
|
||
///// <summary>
|
||
///// 接收WCS反馈入库口货物高度
|
||
///// </summary>
|
||
///// <returns></returns>]
|
||
//[HttpPost, Route("api/GetCtlHeight")]
|
||
|
||
//public HttpResponseMessage GetCtlHeight([FromBody]JObject WmsInvIn)
|
||
//{
|
||
// string errText = string.Empty;
|
||
// ArrayList SqlList = new ArrayList();
|
||
// string mesJson = WmsInvIn.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// T_Stock_InRequest.ReturnErrorData reerrdata = new T_Stock_InRequest.ReturnErrorData();
|
||
// Log.WriteLog("接收WCS反馈入库口货物高度:" + mesJson);
|
||
|
||
// try
|
||
// {
|
||
|
||
// //字段待定义
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string decid = strJo["taskId"].ToString().Trim();//站台号
|
||
// string height = strJo["reportTime"].ToString().Trim();//高度 1为1-2层高度 2为三层高度 3 为异常高度 不下发任务
|
||
// string taskStatus = strJo["taskStatus"].ToString().Trim();//出库单号
|
||
// string reporInfo = strJo["reporInfo"].ToString().Trim();//异常原因
|
||
|
||
|
||
// //插入入库站台高度采集表
|
||
// string strSql1 = "update T_DECNAME set HGT='" + height + "' where DECID='" + decid + "'";
|
||
// // int Ckflag = OracleHelper.ExecuteNonQuery(CommandType.Text, strSql);
|
||
// int Rkflag = OracleHelper.ExecuteNonQuery(CommandType.Text, strSql1);
|
||
|
||
// if (errText.Length == 0)
|
||
// {
|
||
// if (Rkflag > 0)
|
||
// {
|
||
// reerrdata.returnInfo = "";
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// else
|
||
// {
|
||
// reerrdata.returnInfo = "高度更新失败";
|
||
// reerrdata.returnStatus = "0";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// reerrdata.returnInfo = errText;
|
||
// reerrdata.returnStatus = "0";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// Log.WriteLog("接收WCS反馈入库口货物高度" + ex.Message.ToString());
|
||
// reerrdata.returnInfo = ex.Message.ToString();
|
||
// reerrdata.returnStatus = "0";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
|
||
// }
|
||
|
||
// string strJson2 = JsonConvert.SerializeObject(reerrdata);
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(strJson2, System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
|
||
|
||
//}
|
||
|
||
//#endregion
|
||
//#region 接收WCS拆叠盘入出库信息
|
||
///// <summary>
|
||
///// 接收WCS拆叠盘入出库信息
|
||
///// </summary>
|
||
///// <returns></returns>]
|
||
//[HttpPost, Route("api/GetCDTask")]
|
||
|
||
//public HttpResponseMessage GetCDTask([FromBody]JObject WmsInvIn)
|
||
//{
|
||
// string errText = string.Empty;
|
||
// ArrayList SqlList = new ArrayList();
|
||
// string mesJson = WmsInvIn.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// T_Stock_InRequest.ReturnErrorData reerrdata = new T_Stock_InRequest.ReturnErrorData();
|
||
// Log.WriteLog("接收WCS拆叠盘入出库信息:" + mesJson);
|
||
|
||
// try
|
||
// {
|
||
|
||
// //字段待定义
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string decid = strJo["taskId"].ToString().Trim();//站台号
|
||
// string height = strJo["reportTime"].ToString().Trim();//高度 1为1层高度 2为二层高度 3 为异常高度 不下发任务
|
||
// string taskStatus = strJo["taskStatus"].ToString().Trim();//出库单号
|
||
// string reporInfo = strJo["reporInfo"].ToString().Trim();//异常原因
|
||
|
||
|
||
// //插入入库站台高度采集表
|
||
// string strSql1 = "update T_DECNAME set HGT='" + height + "' where DECID='" + decid + "'";
|
||
// // int Ckflag = OracleHelper.ExecuteNonQuery(CommandType.Text, strSql);
|
||
// int Rkflag = OracleHelper.ExecuteNonQuery(CommandType.Text, strSql1);
|
||
|
||
// if (errText.Length == 0)
|
||
// {
|
||
// if (Rkflag > 0)
|
||
// {
|
||
// reerrdata.returnInfo = "";
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// else
|
||
// {
|
||
// reerrdata.returnInfo = "高度更新失败";
|
||
// reerrdata.returnStatus = "0";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// reerrdata.returnInfo = errText;
|
||
// reerrdata.returnStatus = "0";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// Log.WriteLog("接收WCS拆叠盘入出库信息" + ex.Message.ToString());
|
||
// reerrdata.returnInfo = ex.Message.ToString();
|
||
// reerrdata.returnStatus = "0";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
|
||
// }
|
||
|
||
// string strJson2 = JsonConvert.SerializeObject(reerrdata);
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(strJson2, System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
|
||
|
||
//}
|
||
|
||
//#endregion
|
||
//#region 任务入库申请接口
|
||
///// <summary>
|
||
///// 任务入库申请接口
|
||
///// </summary>
|
||
///// <returns></returns>]
|
||
//[HttpPost, Route("wms/taskApply")]
|
||
//public HttpResponseMessage GetTaskApply([FromBody]JObject WmsInvIn)
|
||
//{
|
||
// lock ("a")
|
||
// {
|
||
// string errText = string.Empty;
|
||
// ArrayList SqlList = new ArrayList();
|
||
// string mesJson = WmsInvIn.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// T_Stock_InRequest.ReturnErrorData reerrdata = new T_Stock_InRequest.ReturnErrorData();
|
||
// Log.WriteLog("接收WCS任务入库申请:" + mesJson);
|
||
|
||
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string applyTime = strJo["applyTime"].ToString().Trim();//申请时间
|
||
// string fromPort = strJo["fromPort"].ToString().Trim();//入库口编号
|
||
// string barCode = strJo["barCode"].ToString().Trim();//托盘码
|
||
// string cargoHeight = strJo["cargoHeight"].ToString().Trim();//货物高度
|
||
// string cargoWeight = strJo["cargoWeight"].ToString().Trim();//货物重量
|
||
// //string height = "";
|
||
|
||
// //if (cargoHeight == "1")
|
||
// //{
|
||
// // cargoHeight = "2";
|
||
// //}
|
||
|
||
|
||
// //cargoHeight = "3";
|
||
// //if (cargoHeight == "3")
|
||
// //{
|
||
// // if (percent >= locaionheight)
|
||
// // {
|
||
// // height = "3";
|
||
// // }
|
||
// // else
|
||
// // {
|
||
// // height = "2";
|
||
// // }
|
||
// //}
|
||
|
||
// //if (cargoHeight == "2")
|
||
// //{
|
||
// // if (percent >= locaionheight)
|
||
// // {
|
||
// // height = "3";
|
||
// // }
|
||
// // else
|
||
// // {
|
||
// // height = "2";
|
||
// // }
|
||
// //}
|
||
|
||
// //if (cargoHeight == "1")
|
||
// //{
|
||
// // if (percent >= locaionheight)
|
||
// // {
|
||
// // cargoHeight = "2";
|
||
// // percent = locationPercent(cargoHeight);
|
||
// // locaionheight = locationSort(cargoHeight);
|
||
// // if (percent >= locaionheight)
|
||
// // {
|
||
// // height = "3";
|
||
// // }
|
||
// // else
|
||
// // {
|
||
// // height = "2";
|
||
// // }
|
||
// // }
|
||
// // else
|
||
// // {
|
||
// // height = "1";
|
||
// // }
|
||
// //}
|
||
|
||
// //if (cargoHeight == "2")
|
||
// //{
|
||
// // if (percent >= locaionheight)
|
||
// // {
|
||
// // height = "3";
|
||
// // }
|
||
// // else
|
||
// // {
|
||
// // height = "2";
|
||
// // }
|
||
// //}
|
||
// //cargoHeight = height;
|
||
// string storage_id = string.Empty;
|
||
// string location_id = string.Empty;
|
||
// string strJSONsend = string.Empty;
|
||
// string strSql = "select STS from T_DECNAME where decid='" + fromPort + "'";
|
||
// int mode = 0;
|
||
// if (fromPort == "A1" || fromPort == "A4")
|
||
// {
|
||
// mode = 3;
|
||
// }
|
||
// else
|
||
// {
|
||
// mode = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).ToString());
|
||
// }
|
||
|
||
|
||
|
||
// if (mode == 0)
|
||
// {
|
||
|
||
// string cpj = "";
|
||
// if (fromPort == "A2")
|
||
// {
|
||
// cpj = "JW-12-40-01";
|
||
// }
|
||
// if (fromPort == "A3")
|
||
// {
|
||
// cpj = "JW-17-40-01";
|
||
// }
|
||
// JArray ja = new JArray();
|
||
|
||
// JObject jo = new JObject
|
||
// (
|
||
// new JProperty("taskId", "TRAN" + Guid.NewGuid().ToString()),
|
||
// new JProperty("taskType", "8"),
|
||
// new JProperty("startNode", fromPort),
|
||
// new JProperty("endNode", cpj),
|
||
// new JProperty("barCode", "1"),
|
||
// new JProperty("order", "0")
|
||
// );
|
||
// ja.Add(jo);
|
||
// JObject joReturn = new JObject
|
||
// (
|
||
// new JProperty("groupId", "TRAN" + Guid.NewGuid().ToString()),
|
||
// new JProperty("msgTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss")),
|
||
// new JProperty("priorityCode", "1"),
|
||
// new JProperty("district", "JXJW"),
|
||
// new JProperty("tasks", ja)
|
||
// );
|
||
// strJSONsend = joReturn.ToString();
|
||
// Log.WriteLog("发送WCS入库任务" + strJSONsend);
|
||
// string resJson = PostJSON("http://10.50.68.61:8082/fromWms/taskReceive", strJSONsend, ref errText);
|
||
// Log.WriteLog("WCS任务接收接口返回JSON:" + resJson);
|
||
// JObject strJo2 = (JObject)JsonConvert.DeserializeObject(resJson);
|
||
// string returnStatus = strJo2["returnStatus"].ToString().Trim();//请求结果
|
||
// string returnInfo = strJo2["returnInfo"].ToString().Trim();//请求结果描述
|
||
// }
|
||
// else if (mode == 1 || mode == 3)
|
||
// {
|
||
// strSql = "select * from T_ONGOODSSHELF where (STORAGE_ID ='JXJW' or STORAGE_ID= 'JXJWTH') and DECID='" + fromPort + "' and status=1 ";
|
||
// DataSet decIddt = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql);
|
||
// if (decIddt.Tables[0].Rows.Count > 0)
|
||
// {
|
||
// string STORAGE_ID = decIddt.Tables[0].Rows[0]["STORAGE_ID"].ToString();
|
||
// string STORAGE_MODE = decIddt.Tables[0].Rows[0]["STORAGE_MODE"].ToString();
|
||
// string STORAGE_AREA_ID = decIddt.Tables[0].Rows[0]["STORAGE_AREA_ID"].ToString();
|
||
// string plcid = decIddt.Tables[0].Rows[0]["PLCID"].ToString();
|
||
// string getlock = GetLock();
|
||
// if (locationPercent(cargoHeight, STORAGE_AREA_ID) > 80)
|
||
// {
|
||
// cargoHeight = "3";
|
||
// }
|
||
// if (STORAGE_MODE.Length == 0)
|
||
// {
|
||
// if (fromPort == "A1" || fromPort == "A4")
|
||
// {
|
||
// strSql = "select STS from T_DECNAME where decid='A2'";
|
||
|
||
// int a1 = 0;
|
||
// a1 = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).ToString());
|
||
// strSql = "select STS from T_DECNAME where decid='A3'";
|
||
// int a4 = 0;
|
||
// a4 = int.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).ToString());
|
||
// if (a1 == 2 && a4 == 2)
|
||
// {
|
||
// strSql = "select * from T_BASE_STORAGE_AREA_LOCATION where location_height=3 and STORAGE_AREA_ID='" + STORAGE_AREA_ID + "' and STORAGE_ID='" + STORAGE_ID + "' and status='0' and location_id not in " + getlock + " order by sort ";
|
||
// }
|
||
// else
|
||
// {
|
||
// strSql = "select * from T_BASE_STORAGE_AREA_LOCATION where location_height='" + cargoHeight + "' and STORAGE_AREA_ID='" + STORAGE_AREA_ID + "' and STORAGE_ID='" + STORAGE_ID + "' and status='0' and location_id not in " + getlock + " order by sort ";
|
||
// }
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// strSql = "select * from T_BASE_STORAGE_AREA_LOCATION where location_height='" + cargoHeight + "' and STORAGE_AREA_ID='" + STORAGE_AREA_ID + "' and STORAGE_ID='" + STORAGE_ID + "' and status='0' and location_id not in " + getlock + " order by sort ";
|
||
// }
|
||
|
||
// }
|
||
// if (STORAGE_MODE == "1")
|
||
// {
|
||
|
||
// strSql = "select * from T_BASE_STORAGE_AREA_LOCATION where location_height=3 and STORAGE_ID='" + STORAGE_ID + "' and status='0' and location_id not in " + getlock + " order by sort ";
|
||
// }
|
||
// Log.WriteLog("入库申请库位 SQL" + strSql);
|
||
// DataSet ds = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql);
|
||
// if (ds != null)
|
||
// {
|
||
|
||
// DataTable dt = ds.Tables[0];
|
||
// if (dt != null)
|
||
// {
|
||
// if (dt.Rows.Count == 0)
|
||
// {
|
||
// cargoHeight = "3";
|
||
// strSql = "select * from T_BASE_STORAGE_AREA_LOCATION where location_height='" + cargoHeight + "' and STORAGE_AREA_ID='" + STORAGE_AREA_ID + "' and STORAGE_ID='" + STORAGE_ID + "' and status='0' and location_id not in " + getlock + " order by sort ";
|
||
// ds = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql);
|
||
// dt = ds.Tables[0];
|
||
// }
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// string cpj = "";
|
||
// if (fromPort == "A2")
|
||
// {
|
||
// cpj = "JW-12-40-01";
|
||
// }
|
||
// if (fromPort == "A3")
|
||
// {
|
||
// cpj = "JW-17-40-01";
|
||
// }
|
||
|
||
// storage_id = dt.Rows[0]["storage_id"].ToString();
|
||
// location_id = dt.Rows[0]["location_id"].ToString();
|
||
// //strSql = "select seq_plc_taskval.nextval from dual";
|
||
// //string Plcid = OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).ToString();
|
||
// JArray ja = new JArray();
|
||
|
||
|
||
// JObject jo = new JObject
|
||
// (
|
||
// new JProperty("taskId", plcid),
|
||
// new JProperty("taskType", "0"),
|
||
// new JProperty("startNode", fromPort),
|
||
// new JProperty("endNode", location_id),
|
||
// new JProperty("barCode", "1"),
|
||
// new JProperty("order", "0")
|
||
// );
|
||
// //ja.Add(jo1);
|
||
// ja.Add(jo);
|
||
// JObject joReturn = new JObject
|
||
// (
|
||
// new JProperty("groupId", plcid),
|
||
// new JProperty("msgTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss")),
|
||
// new JProperty("priorityCode", "1"),
|
||
// new JProperty("district", "JXJW"),
|
||
// new JProperty("tasks", ja)
|
||
// );
|
||
// strJSONsend = joReturn.ToString();
|
||
// Log.WriteLog(strJSONsend);
|
||
// string resJson = PostJSON("http://10.50.68.61:8082/fromWms/taskReceive", strJSONsend, ref errText);
|
||
// Log.WriteLog("任务接收接口返回JSON:" + resJson);
|
||
// JObject strJo2 = (JObject)JsonConvert.DeserializeObject(resJson);
|
||
// string returnStatus = strJo2["returnStatus"].ToString().Trim();//请求结果
|
||
// string returnInfo = strJo2["returnInfo"].ToString().Trim();//请求结果描述
|
||
// OracleTransaction transaction = OracleHelper.BeginTransaction(OracleHelper.RemoteConnectionString);
|
||
|
||
// if (returnStatus == "0")//成功
|
||
// {
|
||
|
||
// string SqlStr = "update T_BASE_STORAGE_AREA_LOCATION set status='1' where location_id='" + location_id + "' and storage_id='" + storage_id + "' ";
|
||
// OracleHelper.ExecuteNonQuery(transaction, SqlStr);
|
||
|
||
// SqlStr = "update T_ONGOODSSHELF set location_id = '" + location_id + "',status=3 where plcid='" + plcid + "'";
|
||
// OracleHelper.ExecuteNonQuery(transaction, SqlStr);
|
||
|
||
// OracleHelper.CommitTransaction(transaction);
|
||
|
||
// reerrdata.returnInfo = "";
|
||
// reerrdata.returnStatus = "0";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// else
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// reerrdata.returnInfo = returnInfo;
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// reerrdata.returnInfo = "无空库位";
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// reerrdata.returnInfo = "无空库位";
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// reerrdata.returnInfo = fromPort + "口,没有任务";
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// }
|
||
// else if (mode == 2)
|
||
// {
|
||
// string cpj = "";
|
||
// if (fromPort == "A2")
|
||
// {
|
||
// cpj = "JW-12-40-01";
|
||
// }
|
||
// if (fromPort == "A3")
|
||
// {
|
||
// cpj = "JW-17-40-01";
|
||
// }
|
||
// JArray ja = new JArray();
|
||
|
||
// JObject jo = new JObject
|
||
// (
|
||
// new JProperty("taskId", "TRAN" + Guid.NewGuid().ToString()),
|
||
// new JProperty("taskType", "8"),
|
||
// new JProperty("startNode", fromPort),
|
||
// new JProperty("endNode", cpj),
|
||
// new JProperty("barCode", "1"),
|
||
// new JProperty("order", "0")
|
||
// );
|
||
// ja.Add(jo);
|
||
// JObject joReturn = new JObject
|
||
// (
|
||
// new JProperty("groupId", "TRAN" + Guid.NewGuid().ToString()),
|
||
// new JProperty("msgTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss")),
|
||
// new JProperty("priorityCode", "1"),
|
||
// new JProperty("district", "JXJW"),
|
||
// new JProperty("tasks", ja)
|
||
// );
|
||
// strJSONsend = joReturn.ToString();
|
||
// Log.WriteLog(strJSONsend);
|
||
// string resJson = PostJSON("http://10.50.68.61:8082/fromWms/taskReceive", strJSONsend, ref errText);
|
||
// Log.WriteLog("任务接收接口返回JSON:" + resJson);
|
||
// JObject strJo2 = (JObject)JsonConvert.DeserializeObject(resJson);
|
||
// string returnStatus = strJo2["returnStatus"].ToString().Trim();//请求结果
|
||
// string returnInfo = strJo2["returnInfo"].ToString().Trim();//请求结果描述
|
||
// }
|
||
|
||
|
||
|
||
|
||
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// Log.WriteLog("接收任务入库申请" + ex.Message.ToString());
|
||
// reerrdata.returnInfo = ex.Message.ToString();
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
|
||
// }
|
||
|
||
// string strJson2 = JsonConvert.SerializeObject(reerrdata);
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(strJson2, System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
// }
|
||
|
||
//}
|
||
|
||
//#endregion
|
||
//#region 空托盘入库
|
||
///// <summary>
|
||
///// 空托盘入库申请接口
|
||
///// </summary>
|
||
///// <returns></returns>]
|
||
//[HttpPost, Route("wms/emptyPalletApply")]
|
||
|
||
//public HttpResponseMessage emptyPalletApply([FromBody]JObject emptyPalletApply)
|
||
//{
|
||
// string errText = string.Empty;
|
||
// ArrayList SqlList = new ArrayList();
|
||
// string mesJson = emptyPalletApply.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// T_Stock_InRequest.ReturnErrorData reerrdata = new T_Stock_InRequest.ReturnErrorData();
|
||
// Log.WriteLog("接收任务入库申请:" + mesJson);
|
||
|
||
|
||
// try
|
||
// {
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string applyTime = strJo["applyTime"].ToString().Trim();//申请时间
|
||
// string fromPort = strJo["fromPort"].ToString().Trim();//入库口编号
|
||
// string taskType = strJo["taskType"].ToString().Trim();//数量
|
||
// string palletNum = strJo["palletNum"].ToString().Trim();//货物高度
|
||
// string storage_id = string.Empty;
|
||
// string location_id = string.Empty;
|
||
// string strJSONsend = string.Empty;
|
||
|
||
|
||
// if (taskType == "0")
|
||
// {
|
||
// string strSql = "select * from T_BASE_STORAGE_AREA_LOCATION where location_height='3' and status='0' and islock='1' order by sort ";
|
||
// DataSet ds = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql);
|
||
// if (ds != null)
|
||
// {
|
||
|
||
// DataTable dt = ds.Tables[0];
|
||
// if (dt != null)
|
||
// {
|
||
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
|
||
// OracleTransaction transaction = OracleHelper.BeginTransaction(OracleHelper.RemoteConnectionString);
|
||
// storage_id = dt.Rows[0]["storage_id"].ToString();
|
||
// location_id = dt.Rows[0]["location_id"].ToString();
|
||
// strSql = "select seq_plc_taskval.nextval from dual";
|
||
// string Plcid = OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).ToString();
|
||
// string userId = "wcs";//用户id
|
||
// string formId = "JXJW";
|
||
// string Lotid = "SJ" + DateTime.Now.ToString("yyyymmddhhmmsssss");
|
||
// string outbarcode = "";
|
||
// string itmcode = "00000";
|
||
// string itmversion = "";
|
||
// //string itmname = dt.Rows[i]["itmname"].ToString();
|
||
// string datecode = "";
|
||
// string storename = "";
|
||
// string fbgtype = "";
|
||
// // string fgbno = dt.Rows[i]["fgbno"].ToString();
|
||
// string qty = palletNum;
|
||
|
||
// JArray ja = new JArray();
|
||
|
||
// JObject jo = new JObject
|
||
// (
|
||
// new JProperty("taskId", Plcid),
|
||
// new JProperty("taskType", taskType),
|
||
// new JProperty("startNode", fromPort),
|
||
// new JProperty("endNode", location_id),
|
||
// new JProperty("barCode", "1"),
|
||
// new JProperty("order", "0")
|
||
// );
|
||
// ja.Add(jo);
|
||
// JObject joReturn = new JObject
|
||
// (
|
||
// new JProperty("groupId", Plcid),
|
||
// new JProperty("msgTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss")),
|
||
// new JProperty("priorityCode", "1"),
|
||
// new JProperty("district", "JXJW"),
|
||
// new JProperty("tasks", ja)
|
||
// );
|
||
// strJSONsend = joReturn.ToString();
|
||
// Log.WriteLog(strJSONsend);
|
||
// string resJson = PostJSON("http://10.50.68.61:8082/fromWms/taskReceive", strJSONsend, ref errText);
|
||
// Log.WriteLog("任务接收接口返回JSON:" + resJson);
|
||
// JObject strJo2 = (JObject)JsonConvert.DeserializeObject(resJson);
|
||
// string returnStatus = strJo2["returnStatus"].ToString().Trim();//请求结果
|
||
// string returnInfo = strJo2["returnInfo"].ToString().Trim();//请求结果描述
|
||
|
||
|
||
// if (returnStatus == "0")//成功
|
||
// {
|
||
|
||
// string SqlStr = "insert into T_ONGOODSSHELF(LOT_ID,GOODSID,STO_NUM,ACC_NUM,SHELF_NUM,STOCK_NUM,Ondate,Onshelfuserid,Storage_Id,STORAGE_AREA_ID,GOODS_MEASURE_ID,Status,barcode,BAOZHIQI,REMARK,DECID,TASKTYPE,LOCATION_ID,PLCID) values('" + Lotid + "','" + itmcode + "'," + qty + "," + qty + "," + qty + "," + qty + ",SYSDATE,'" + userId + "','" + formId + "','" + storename + "','" + itmversion + "','0','" + outbarcode + "','" + fbgtype + "','" + datecode + "','" + fromPort + "','1','" + location_id + "','" + Plcid + "')";
|
||
// OracleHelper.ExecuteNonQuery(transaction, CommandType.Text, SqlStr);
|
||
// SqlStr = "update T_BASE_STORAGE_AREA_LOCATION set status='1' where location_id='" + location_id + "' and storage_id='" + storage_id + "' ";
|
||
// OracleHelper.ExecuteNonQuery(transaction, SqlStr);
|
||
|
||
// OracleHelper.CommitTransaction(transaction);
|
||
// reerrdata.returnInfo = "";
|
||
// reerrdata.returnStatus = "0";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// else
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// reerrdata.returnInfo = returnInfo;
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// reerrdata.returnInfo = "无空库位";
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// reerrdata.returnInfo = "无空库位";
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// }
|
||
// }
|
||
// if (taskType == "1")
|
||
// {
|
||
// string strSql = "select * from T_MI_STOCK a left join t_base_storage_area_location b on a.location_id=b.location_id where a.GOODS_ID='00000' and a.sts=0 order by b.sort desc ";
|
||
// DataSet ds = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql);
|
||
// if (ds != null)
|
||
// {
|
||
|
||
// DataTable dt = ds.Tables[0];
|
||
// if (dt != null)
|
||
// {
|
||
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
|
||
|
||
// storage_id = dt.Rows[0]["storage_id"].ToString();
|
||
// location_id = dt.Rows[0]["location_id"].ToString();
|
||
// strSql = "select seq_plc_taskval.nextval from dual";
|
||
// string Plcid = OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, strSql).ToString();
|
||
|
||
// string Lotid = "CK" + DateTime.Now.ToString("yyyymmddhhmmsssss");
|
||
|
||
// string qty = palletNum;
|
||
// List<MIStockModel> goodsinfo = DataCommon.ConvertHelper<MIStockModel>.ConvertToList(dt);
|
||
// OracleTransaction transaction = OracleHelper.BeginTransaction(OracleHelper.RemoteConnectionString);
|
||
// strSql = "insert into T_CK_PICKINGWAVEGOODS(PICKINGID,PUTIN_ID,GOOD_ID,LOC_ID,GOODS_NUM,REMARK,PICKING_NUM,BARCODE,STORAGE_ID,STORAGE_AREA_ID,GOODS_NUM_SJ,STATUS,CK_TYPE,TYPESTS,CUSTOMERMEMBERID,PLCID,OUTSTAND) ";
|
||
// strSql += " values('" + Lotid + "','" + location_id + "','" + goodsinfo[0].GOODS_ID + "','" + goodsinfo[0].LOCATION_ID + "','" + goodsinfo[0].SHELVES_NUM + "','" + goodsinfo[0].REMARK + "','" + goodsinfo[0].SHELVES_NUM + "','" + goodsinfo[0].BARCODE + "','" + goodsinfo[0].STORAGE_ID + "','" + goodsinfo[0].AREA_ID + "','" + goodsinfo[0].SHELVES_NUM + "','1','FXCK','0','wcs','" + Plcid + "','" + fromPort + "')";
|
||
// int returnStatus = OracleHelper.ExecuteNonQuery(transaction, CommandType.Text, strSql);
|
||
|
||
|
||
// if (returnStatus > 0)//成功
|
||
// {
|
||
// string SqlStr = "update T_MI_STOCK set STS=1 where LOCATION_ID='" + location_id + "' ";
|
||
// OracleHelper.ExecuteNonQuery(transaction, SqlStr);
|
||
|
||
// OracleHelper.CommitTransaction(transaction);
|
||
// reerrdata.returnInfo = "";
|
||
// reerrdata.returnStatus = "0";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// else
|
||
// {
|
||
// OracleHelper.RollbackTransaction(transaction);
|
||
// reerrdata.returnInfo = "申请失败";
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// reerrdata.returnInfo = "无空库位";
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// reerrdata.returnInfo = "无空库位";
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// Log.WriteLog("接收任务入库申请" + ex.Message.ToString());
|
||
// reerrdata.returnInfo = ex.Message.ToString();
|
||
// reerrdata.returnStatus = "1";
|
||
// reerrdata.msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.sss");
|
||
|
||
// }
|
||
|
||
// string strJson2 = JsonConvert.SerializeObject(reerrdata);
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(strJson2, System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
|
||
|
||
//}
|
||
|
||
//#endregion
|
||
//#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.ContentLength = buffer.Length;
|
||
// //发送内容格式
|
||
// objrequest.ContentType = "application/json";
|
||
// try
|
||
// {
|
||
// mywriter = new StreamWriter(objrequest.GetRequestStream());
|
||
// mywriter.Write(strPost);
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// errText = ex.Message;
|
||
// result = "发送JSON失败!";
|
||
|
||
// }
|
||
// finally
|
||
// {
|
||
// mywriter.Close();
|
||
// }
|
||
// //读取服务器返回信息c
|
||
// HttpWebResponse objresponse = (HttpWebResponse)objrequest.GetResponse();
|
||
// using (StreamReader sr = new StreamReader(objresponse.GetResponseStream()))
|
||
// {
|
||
// result = sr.ReadToEnd();
|
||
// sr.Close();
|
||
// }
|
||
// return result;
|
||
//}
|
||
|
||
//#endregion
|
||
|
||
//#region
|
||
//public string GetLock()
|
||
//{
|
||
|
||
// string SqlStr = "('1',";
|
||
// string locid = string.Empty;
|
||
// try
|
||
// {
|
||
|
||
|
||
// string strSql = "select distinct LOCATION_ID from t_ongoodsshelf where (storage_id='JXJW' or storage_id='JXJWTH')";
|
||
// string strSqlCk = "select distinct LOC_ID from T_CK_PICKINGWAVEGOODS where (storage_id='JXJW' or storage_id='JXJWTH') and length(pickingid)<21 ";
|
||
// string strSqlOutstand = "select distinct outstand from T_CK_PICKINGWAVEGOODS where (storage_id='JXJW' or storage_id='JXJWTH') and substr(outstand,1,1)='J' ";
|
||
|
||
// #region 排斥正在入库大库位
|
||
// DataSet ds = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSql);
|
||
// if (ds != null)
|
||
// {
|
||
|
||
// DataTable dt = ds.Tables[0];
|
||
// if (dt != null)
|
||
// {
|
||
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// for (int i = 0; i < dt.Rows.Count; i++)
|
||
// {
|
||
// locid = dt.Rows[i]["LOCATION_ID"].ToString().Trim();
|
||
// if (locid != string.Empty)
|
||
// {
|
||
// Log.WriteLog("正在入库库位" + locid);
|
||
// string lockloc = string.Empty;
|
||
// string Xloc = locid.Substring(3, 2).ToString();
|
||
// string Yloc = locid.Substring(6, 2).ToString();
|
||
// string Zloc = locid.Substring(locid.Length - 1, 1);
|
||
|
||
// if (int.Parse(Xloc) > 0 && int.Parse(Xloc) < 4)
|
||
// {
|
||
// for (int j = 1; j < 4; j++)
|
||
// {
|
||
// lockloc = "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
||
// SqlStr += "'" + lockloc + "',";
|
||
// }
|
||
// }
|
||
// else if (int.Parse(Xloc) > 4 && int.Parse(Xloc) < 11)
|
||
// {
|
||
// for (int j = 5; j < 11; j++)
|
||
// {
|
||
// lockloc = "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
||
// SqlStr += "'" + lockloc + "',";
|
||
// }
|
||
// }
|
||
// else if (int.Parse(Xloc) > 11 && int.Parse(Xloc) < 18)
|
||
// {
|
||
// for (int j = 12; j < 18; j++)
|
||
// {
|
||
// lockloc = "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
||
// SqlStr += "'" + lockloc + "',";
|
||
// }
|
||
// }
|
||
// else if (int.Parse(Xloc) > 18 && int.Parse(Xloc) < 25)
|
||
// {
|
||
// for (int j = 19; j < 25; j++)
|
||
// {
|
||
// lockloc = "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
||
// SqlStr += "'" + lockloc + "',";
|
||
// }
|
||
// }
|
||
// else if (int.Parse(Xloc) > 25 && int.Parse(Xloc) < 29)
|
||
// {
|
||
// for (int j = 26; j < 29; j++)
|
||
// {
|
||
// lockloc = "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
||
// SqlStr += "'" + lockloc + "',";
|
||
// }
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
// }
|
||
// }
|
||
// }
|
||
// #endregion
|
||
|
||
|
||
// #region 排斥正在出库大库位
|
||
// DataSet ckds = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSqlCk);
|
||
// if (ckds != null)
|
||
// {
|
||
// DataTable dt2 = ckds.Tables[0];
|
||
// if (dt2 != null)
|
||
// {
|
||
|
||
|
||
// if (dt2.Rows.Count > 0)
|
||
// {
|
||
|
||
// //排斥正在出库任务与入库寻找货位时 寻找同一大库位的情况
|
||
// for (int i = 0; i < dt2.Rows.Count; i++)
|
||
// {
|
||
// locid = dt2.Rows[i]["LOC_ID"].ToString().Trim();
|
||
// if (locid != string.Empty)
|
||
// {
|
||
// string lockloc = string.Empty;
|
||
// string Xloc = locid.Substring(3, 2).ToString();
|
||
// string Yloc = locid.Substring(6, 2).ToString();
|
||
// string Zloc = locid.Substring(locid.Length - 1, 1);
|
||
|
||
// if (int.Parse(Xloc) > 0 && int.Parse(Xloc) < 4)
|
||
// {
|
||
// for (int j = 1; j < 4; j++)
|
||
// {
|
||
// lockloc = "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
||
// SqlStr += "'" + lockloc + "',";
|
||
// }
|
||
// }
|
||
// else if (int.Parse(Xloc) > 4 && int.Parse(Xloc) < 11)
|
||
// {
|
||
// for (int j = 5; j < 11; j++)
|
||
// {
|
||
// lockloc = "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
||
// SqlStr += "'" + lockloc + "',";
|
||
// }
|
||
// }
|
||
// else if (int.Parse(Xloc) > 11 && int.Parse(Xloc) < 18)
|
||
// {
|
||
// for (int j = 12; j < 18; j++)
|
||
// {
|
||
// lockloc = "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
||
// SqlStr += "'" + lockloc + "',";
|
||
// }
|
||
// }
|
||
// else if (int.Parse(Xloc) > 18 && int.Parse(Xloc) < 25)
|
||
// {
|
||
// for (int j = 19; j < 25; j++)
|
||
// {
|
||
// lockloc = "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
||
// SqlStr += "'" + lockloc + "',";
|
||
// }
|
||
// }
|
||
// else if (int.Parse(Xloc) > 25 && int.Parse(Xloc) < 29)
|
||
// {
|
||
// for (int j = 26; j < 29; j++)
|
||
// {
|
||
// lockloc = "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
||
// SqlStr += "'" + lockloc + "',";
|
||
// }
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
// }
|
||
// }
|
||
// }
|
||
// #endregion
|
||
|
||
|
||
// #region 排斥正在移库要到的库位
|
||
// DataSet ykoutstand = OracleHelper.ExecuteDataset(OracleHelper.RemoteConnectionString, CommandType.Text, strSqlOutstand);
|
||
// if (ykoutstand != null)
|
||
// {
|
||
// DataTable dt3 = ykoutstand.Tables[0];
|
||
// if (dt3 != null)
|
||
// {
|
||
// if (dt3.Rows.Count > 0)
|
||
// {
|
||
|
||
// //排斥正在出库任务与入库寻找货位时 寻找同一大库位的情况
|
||
// for (int i = 0; i < dt3.Rows.Count; i++)
|
||
// {
|
||
// locid = dt3.Rows[i]["OUTSTAND"].ToString().Trim();
|
||
// if (locid != string.Empty)
|
||
// {
|
||
// string lockloc = string.Empty;
|
||
// string Xloc = locid.Substring(3, 2).ToString();
|
||
// string Yloc = locid.Substring(6, 2).ToString();
|
||
// string Zloc = locid.Substring(locid.Length - 1, 1);
|
||
|
||
// if (int.Parse(Xloc) > 0 && int.Parse(Xloc) < 4)
|
||
// {
|
||
// for (int j = 1; j < 4; j++)
|
||
// {
|
||
// lockloc = "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
||
// SqlStr += "'" + lockloc + "',";
|
||
// }
|
||
// }
|
||
// else if (int.Parse(Xloc) > 4 && int.Parse(Xloc) < 11)
|
||
// {
|
||
// for (int j = 5; j < 11; j++)
|
||
// {
|
||
// lockloc = "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
||
// SqlStr += "'" + lockloc + "',";
|
||
// }
|
||
// }
|
||
// else if (int.Parse(Xloc) > 11 && int.Parse(Xloc) < 18)
|
||
// {
|
||
// for (int j = 12; j < 18; j++)
|
||
// {
|
||
// lockloc = "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
||
// SqlStr += "'" + lockloc + "',";
|
||
// }
|
||
// }
|
||
// else if (int.Parse(Xloc) > 18 && int.Parse(Xloc) < 25)
|
||
// {
|
||
// for (int j = 19; j < 25; j++)
|
||
// {
|
||
// lockloc = "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
||
// SqlStr += "'" + lockloc + "',";
|
||
// }
|
||
// }
|
||
// else if (int.Parse(Xloc) > 25 && int.Parse(Xloc) < 29)
|
||
// {
|
||
// for (int j = 26; j < 29; j++)
|
||
// {
|
||
// lockloc = "JW-" + j.ToString().PadLeft(2, '0') + "-" + Yloc + "-" + Zloc.PadLeft(2, '0');
|
||
// SqlStr += "'" + lockloc + "',";
|
||
// }
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
// }
|
||
// }
|
||
|
||
// }
|
||
// #endregion
|
||
// }
|
||
// catch
|
||
// {
|
||
|
||
// }
|
||
// SqlStr = SqlStr.Substring(0, SqlStr.Length - 1);
|
||
// SqlStr += ")";
|
||
// return SqlStr;
|
||
//}
|
||
//private double locationSort(string height)
|
||
//{
|
||
// string sqlStr = "select t.sort from t_base_storage_area t where storage_id='" + height + "'";
|
||
// return double.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sqlStr).ToString());
|
||
//}
|
||
//private double locationPercent(string height, string storage_area_id)
|
||
//{
|
||
// string sqlStr = "select count(*) from T_BASE_STORAGE_AREA_LOCATION where location_height='" + height + "' AND STORAGE_AREA_ID='" + storage_area_id + "' ";
|
||
// double all = double.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sqlStr).ToString());
|
||
// sqlStr = "select count(*) from T_BASE_STORAGE_AREA_LOCATION where location_height='" + height + "' and location_id in (select location_id from T_MI_STOCK) AND STORAGE_AREA_ID='" + storage_area_id + "' ";
|
||
// double occupy = double.Parse(OracleHelper.ExecuteScalar(OracleHelper.RemoteConnectionString, CommandType.Text, sqlStr).ToString());
|
||
|
||
// return (occupy / all) * 100;
|
||
//}
|
||
|
||
|
||
//#endregion
|
||
|
||
|
||
//#region MES-WMS接口
|
||
//#region //2.1 物料请求出库
|
||
//[HttpPost, Route("Api/Wms/MaterialReq")]
|
||
//public HttpResponseMessage MaterialReq([FromBody] JObject MaterialReq)
|
||
//{
|
||
// lock ("MaterialReq")
|
||
// {
|
||
// JObject jo = new JObject(
|
||
// new JProperty("resultCode", ""),
|
||
// new JProperty("resultMessage", "")
|
||
// );
|
||
// string mesJson = MaterialReq.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收MES物料请求出库:" + mesJson);
|
||
|
||
// ArrayList SqlList = new ArrayList();
|
||
|
||
// try
|
||
// {
|
||
// string strSqlAdd = "";
|
||
// string ORDER_ID = "CK" + DateTime.Now.ToString("yyyymmddhhmmsssss");
|
||
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// //string userId = strJo["WmsOutvOut"]["userId"].ToString().Trim();//用户id
|
||
// //string formId = strJo["WmsOutvOut"]["formId"].ToString().Trim();//组织id
|
||
// //string locationId = strJo["WmsOutvOut"]["LocationId"].ToString().Trim();//货位编号
|
||
// string materialReq = strJo["materialReq"].ToString().Trim();//LIST信息
|
||
// DataTable dt = JsonConvert.DeserializeObject<DataTable>(materialReq);
|
||
// decimal sumsty = 0;
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// for (int i = 0; i < dt.Rows.Count; i++)
|
||
// {
|
||
// string GOOD_ID = dt.Rows[i]["materialCode"].ToString();//物料编号
|
||
// string quantity= dt.Rows[i]["quantity"].ToString();//出库数量
|
||
// string subWarehouse = dt.Rows[i]["subWarehouse"].ToString();
|
||
// string STORAGE_AREA_ID = dt.Rows[i]["quantity"].ToString();//子库
|
||
|
||
// string strSql = "";
|
||
|
||
// DataSet ds = RegisterConTainer.CreateConTainerProcess.Get_T_MI_STOCK_GOODS_ID(GOOD_ID);
|
||
// if (ds!=null && ds.Tables[0].Rows.Count > 0)
|
||
// {
|
||
// Random dm = new Random();
|
||
|
||
// strSql = "insert into T_CK_ORDERDETAIL(ORDER_ID,GOOD_ID,GOODS_NUM,STORAGE_AREA_ID,CREATE_DATE)values('" + ORDER_ID + "','"+ GOOD_ID + "',"+ quantity + ",'"+ STORAGE_AREA_ID + "',sysdate)";
|
||
// SqlList.Add(strSql);
|
||
// }
|
||
// else
|
||
// {
|
||
|
||
// jo["resultCode"] = "1";
|
||
// jo["resultMessage"] = "物料编号:"+ GOOD_ID + " WMS无库存,不能出库!!!";
|
||
// HttpResponseMessage result2 = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result2;
|
||
|
||
// }
|
||
// }
|
||
// strSqlAdd = "insert into T_CK_ORDERS(ORDER_ID,REMARK,CREATE_DATE,STATUS)values('" + ORDER_ID + "','2.1物料请求出库',sysdate,'0')";
|
||
// SqlList.Add(strSqlAdd);
|
||
|
||
// }
|
||
|
||
// string errText = "";
|
||
// if (RegisterConTainer.CreateConTainerProcess.ExecuteSqlTran(SqlList, ref errText) > 0)
|
||
// {
|
||
// jo["resultCode"] = "0";
|
||
// jo["resultMessage"] = "接收物料出库任务成功";
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["resultCode"] = "1";
|
||
// jo["resultMessage"] = "接收物料出库任务失败:"+ errText;
|
||
// }
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["resultCode"] = "1";
|
||
// jo["resultMessage"] = ex.Message;
|
||
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
// }
|
||
|
||
|
||
//}
|
||
|
||
|
||
|
||
//#endregion
|
||
|
||
//#region //2.2 物料冻结
|
||
//[HttpPost, Route("Api/Wms/MaterialFreeze")]
|
||
//public HttpResponseMessage MaterialFreeze([FromBody] JObject MaterialFreeze)
|
||
//{
|
||
// lock ("MaterialFreeze")
|
||
// {
|
||
// JObject jo = new JObject(
|
||
// new JProperty("resultCode", ""),
|
||
// new JProperty("resultMessage", "")
|
||
// );
|
||
// string mesJson = MaterialFreeze.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收MES物料冻结:" + mesJson);
|
||
|
||
// ArrayList SqlList = new ArrayList();
|
||
|
||
// try
|
||
// {
|
||
// string strSqlAdd = "";
|
||
// string ORDER_ID = "CK" + DateTime.Now.ToString("yyyymmddhhmmsssss");
|
||
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// //string userId = strJo["WmsOutvOut"]["userId"].ToString().Trim();//用户id
|
||
// //string formId = strJo["WmsOutvOut"]["formId"].ToString().Trim();//组织id
|
||
// //string locationId = strJo["WmsOutvOut"]["LocationId"].ToString().Trim();//货位编号
|
||
// string materialFreeze = strJo["materialFreeze"].ToString().Trim();//LIST信息
|
||
// DataTable dt = JsonConvert.DeserializeObject<DataTable>(materialFreeze);
|
||
// decimal sumsty = 0;
|
||
// if (dt.Rows.Count > 0)
|
||
// {
|
||
// for (int i = 0; i < dt.Rows.Count; i++)
|
||
// {
|
||
// string GOOD_ID = dt.Rows[i]["materialCode"].ToString();//物料编号
|
||
// //string quantity = dt.Rows[i]["quantity"].ToString();//出库数量
|
||
// //string subWarehouse = dt.Rows[i]["subWarehouse"].ToString();
|
||
// //string STORAGE_AREA_ID = dt.Rows[i]["quantity"].ToString();//子库
|
||
|
||
// string strSql = "select * from T_MI_STOCK where GOODS_ID='" + GOOD_ID + "' and sts=0";
|
||
|
||
// DataSet ds = RegisterConTainer.CreateConTainerProcess.Get_T_MI_STOCK_GOODS_ID(GOOD_ID);
|
||
// if (ds != null && ds.Tables[0].Rows.Count > 0)
|
||
// {
|
||
|
||
// strSql = "update T_MI_STOCK set sts=2 where GOODS_ID='" + GOOD_ID + "'";
|
||
// SqlList.Add(strSql);
|
||
// }
|
||
// else
|
||
// {
|
||
|
||
// jo["resultCode"] = "1";
|
||
// jo["resultMessage"] = "物料编号:" + GOOD_ID + " WMS无库存,不能冻结!!!";
|
||
// HttpResponseMessage result2 = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result2;
|
||
|
||
// }
|
||
// }
|
||
|
||
|
||
// }
|
||
|
||
// string errText = "";
|
||
// if (RegisterConTainer.CreateConTainerProcess.ExecuteSqlTran(SqlList, ref errText) > 0)
|
||
// {
|
||
// jo["resultCode"] = "0";
|
||
// jo["resultMessage"] = "接收MES物料冻结成功";
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["resultCode"] = "1";
|
||
// jo["resultMessage"] = "接收MES物料冻结失败:" + errText;
|
||
// }
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["resultCode"] = "1";
|
||
// jo["resultMessage"] = ex.Message;
|
||
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
// }
|
||
|
||
|
||
//}
|
||
//#endregion
|
||
|
||
//#region //2.3 物料库存查询
|
||
|
||
|
||
//[HttpPost, Route("Api/Wms/GetStockInfo")]
|
||
//public HttpResponseMessage GetStockInfo([FromBody] JObject GetStockInfo)
|
||
//{
|
||
// lock ("GetStockInfo")
|
||
// {
|
||
// JObject jo = new JObject(
|
||
// new JProperty("resultCode", ""),
|
||
// new JProperty("resultMessage", ""),
|
||
// new JProperty("TotalQuantity", ""),
|
||
// new JProperty("FreeQuantity", "")
|
||
// );
|
||
// string mesJson = GetStockInfo.ToString().Trim();
|
||
// mesJson = mesJson.Replace(" ", "").ToString();
|
||
// Log.WriteLog("接收MES物料库存查询:" + mesJson);
|
||
|
||
// try
|
||
// {
|
||
|
||
// string ORDER_ID = "CK" + DateTime.Now.ToString("yyyymmddhhmmsssss");
|
||
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
// string GetStockInfoEntity = strJo["GetStockInfoEntity"].ToString().Trim();//LIST信息
|
||
// JObject strJo2 = (JObject)JsonConvert.DeserializeObject(GetStockInfoEntity);
|
||
// string GOOD_ID = strJo2["materialCode"].ToString().Trim();//物料编号
|
||
|
||
// DataSet ds = RegisterConTainer.CreateConTainerProcess.Get_T_MI_STOCK_GOODS_ID(GOOD_ID);
|
||
// if (ds != null && ds.Tables[0].Rows.Count > 0)
|
||
// {
|
||
// DataSet ds2 = RegisterConTainer.CreateConTainerProcess.Get_T_MI_STOCK_GOODS_ID_SUM(GOOD_ID);
|
||
// if (ds2 != null && ds2.Tables[0].Rows.Count > 0)
|
||
// {
|
||
// string TotalQuantity = ds2.Tables[0].Rows[0]["TotalQuantity"].ToString().Trim();
|
||
// string FreeQuantity = ds2.Tables[0].Rows[0]["FreeQuantity"].ToString().Trim();
|
||
// if (Convert.ToDecimal(TotalQuantity) > 0 && Convert.ToDecimal(FreeQuantity) > 0)
|
||
// {
|
||
// jo["resultCode"] = "0";
|
||
// jo["resultMessage"] = "成功";
|
||
// jo["TotalQuantity"] = Convert.ToDouble(TotalQuantity);//总库存
|
||
// jo["FreeQuantity"] = Convert.ToDouble(FreeQuantity);//可用库存数量
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["resultCode"] = "1";
|
||
// jo["resultMessage"] = "物料编号:" + GOOD_ID + ",物料不存在或无库存";
|
||
// jo["TotalQuantity"] = Convert.ToDouble(TotalQuantity);//总库存
|
||
// jo["FreeQuantity"] = Convert.ToDouble(FreeQuantity);//可用库存数量
|
||
// }
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// jo["resultCode"] = "1";
|
||
// jo["resultMessage"] = "物料编号:" + GOOD_ID + " WMS无库存!!!";
|
||
// jo["TotalQuantity"] = 0;//总库存
|
||
// jo["FreeQuantity"] = 0;//可用库存数量
|
||
|
||
// }
|
||
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// jo["resultCode"] = "E";
|
||
// jo["resultMessage"] = ex.Message;
|
||
|
||
// }
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
// }
|
||
|
||
|
||
//}
|
||
|
||
[HttpPost, Route("api/wms/AGVTaskCancel")]
|
||
public HttpResponseMessage AGVCANEL([FromBody] JObject jsonData)
|
||
{
|
||
string errText = string.Empty;
|
||
ArrayList SqlList = new ArrayList();
|
||
MES_RESULT result_empty = new MES_RESULT();
|
||
string mesJson = JsonConvert.SerializeObject(jsonData);
|
||
try
|
||
{
|
||
string taskid = jsonData["taskCode"]?.ToString();//任务号
|
||
if (taskid != "" && taskid != null)
|
||
{
|
||
string sql_on = $"select * from T_ONGOODSSHELF where LOT_ID='{taskid}'";
|
||
DataSet data_on = OracleHelper.ExecuteDataset(CommandType.Text, sql_on);
|
||
if (data_on.Tables[0].Rows.Count > 0)
|
||
{
|
||
string strSql = $"delete T_ONGOODSSHELF where LOT_ID='" + taskid + "'AND STATUS=1";
|
||
try
|
||
{
|
||
int row = OracleHelper.ExecuteNonQuery(CommandType.Text, strSql);
|
||
if (row == 0)
|
||
{
|
||
Log.WriteLog($"删除入库任务{taskid}失败");
|
||
result_empty.resultCode = "0";
|
||
result_empty.resultMessage = "false";
|
||
Log.WriteLog($"删除任务失败,任务号{taskid}:" + result_empty);
|
||
}
|
||
else
|
||
{
|
||
Log.WriteLog($"删除入库任务{taskid}成功");
|
||
result_empty.resultCode = "1";
|
||
result_empty.resultMessage = "true";
|
||
Log.WriteLog($"删除任务成功,任务号{taskid}:" + result_empty);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Log.WriteLog(strSql);
|
||
}
|
||
}
|
||
string sql_out = $"select * from T_CK_PICKINGWAVEGOODS_BACK where PICKINGID='{taskid}'";
|
||
DataSet data_out = OracleHelper.ExecuteDataset(CommandType.Text, sql_out);
|
||
if (data_out.Tables[0].Rows.Count > 0)
|
||
{
|
||
string strSql = $"update T_CK_PICKINGWAVEGOODS_BACK set STATUS=10 where PICKINGID='" + taskid + "'";
|
||
try
|
||
{
|
||
int row = OracleHelper.ExecuteNonQuery(CommandType.Text, strSql);
|
||
if (row == 0)
|
||
{
|
||
Log.WriteLog($"更新出库任务{taskid}失败");
|
||
result_empty.resultCode = "0";
|
||
result_empty.resultMessage = "false";
|
||
Log.WriteLog($"删除任务失败,任务号{taskid}:" + result_empty);
|
||
}
|
||
else
|
||
{
|
||
Log.WriteLog($"更新出库任务{taskid}成功");
|
||
result_empty.resultCode = "1";
|
||
result_empty.resultMessage = "true";
|
||
Log.WriteLog($"删除任务成功,任务号{taskid}:" + result_empty);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Log.WriteLog(strSql);
|
||
}
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
result_empty.resultCode = "0";
|
||
result_empty.resultMessage = "false";
|
||
Log.WriteLog($"任务号异常,任务号{taskid}:" + result_empty);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Log.WriteLog("异常:" + ex + "实际接收内容:" + mesJson);
|
||
}
|
||
string strJson2 = JsonConvert.SerializeObject(result_empty);
|
||
HttpResponseMessage result = new HttpResponseMessage
|
||
{
|
||
Content = new StringContent(strJson2, System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
};
|
||
return result;
|
||
}
|
||
|
||
|
||
|
||
//#endregion
|
||
|
||
#region 辅料仓
|
||
|
||
#region MES物料退料(退库)
|
||
[HttpPost, Route("Api/Wms/MaterialReturnForTest")]
|
||
|
||
public HttpResponseMessage MaterialReturn([FromBody] JObject jsonData)
|
||
{
|
||
string errText = string.Empty;
|
||
ArrayList SqlList = new ArrayList();
|
||
MES_RESULT result_empty = new MES_RESULT();
|
||
string mesJson = JsonConvert.SerializeObject(jsonData);
|
||
try
|
||
{
|
||
string lpnNo = jsonData["lpnNo"]?.ToString();//托盘号
|
||
string materialCode = jsonData["materialCode"]?.ToString();//物料号
|
||
string model = jsonData["model"]?.ToString();//测试架型号
|
||
string totalQuantity = jsonData["totalQuantity"]?.ToString();//总寿命
|
||
string usedQuantity = jsonData["usedQuantity"]?.ToString();//当前剩余寿命
|
||
string machineNo = jsonData["machineNo"]?.ToString();//地址
|
||
string istruereturn = jsonData["isTrueReturn"]?.ToString();//Y-实际退库;N-虚拟退库
|
||
//string positionNo = jsonData["positionNo"]?.ToString();
|
||
Log.WriteLog($"MES-WMS退库任务箱号:{lpnNo}测试架{model}:" + mesJson);
|
||
if (string.IsNullOrEmpty(lpnNo) ||
|
||
string.IsNullOrEmpty(totalQuantity) ||
|
||
string.IsNullOrEmpty(machineNo) ||
|
||
string.IsNullOrEmpty(usedQuantity))
|
||
{
|
||
|
||
result_empty.resultCode = "0";
|
||
result_empty.resultMessage = "异常,有必填项目为空";
|
||
Log.WriteLog("MES-WMS下发任务异常:" + result_empty);
|
||
}
|
||
else
|
||
{
|
||
|
||
//查询当前有没有ru库任务
|
||
try
|
||
{
|
||
if (RegisterConTainer.CreateConTainerProcess.SELECT_ONGOODS(lpnNo))
|
||
{
|
||
//生成一个任务号
|
||
string LOT_ID = "CK" + GenerateTaskId();
|
||
DateTime dateTime = DateTime.Now;
|
||
Random random = new Random();
|
||
string PLCID = random.Next(0, 30000).ToString();
|
||
//插入一条状态0的入库任务
|
||
if (RegisterConTainer.CreateConTainerProcess.INSERT_T_ONGOODS(LOT_ID, lpnNo, model, model, totalQuantity, usedQuantity, machineNo, "202", dateTime, istruereturn))
|
||
{
|
||
result_empty.resultCode = "1";
|
||
result_empty.resultMessage = "true";
|
||
Log.WriteLog($"MES-WMS下发任务成功,任务号{LOT_ID}:" + result_empty);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
result_empty.resultCode = "0";
|
||
result_empty.resultMessage = "异常,该托盘号已有入库任务";
|
||
Log.WriteLog("MES-WMS下发任务异常:" + result_empty);
|
||
}
|
||
}
|
||
catch
|
||
{
|
||
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Log.WriteLog("异常:" + ex + "实际接收内容:" + mesJson);
|
||
}
|
||
string strJson2 = JsonConvert.SerializeObject(result_empty);
|
||
HttpResponseMessage result = new HttpResponseMessage
|
||
{
|
||
Content = new StringContent(strJson2, System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
};
|
||
return result;
|
||
|
||
}
|
||
|
||
[HttpPost, Route("agv.report")]
|
||
public HttpResponseMessage Error_Report([FromBody] JObject jsonData)
|
||
{
|
||
|
||
string errText = string.Empty;
|
||
ArrayList SqlList = new ArrayList();
|
||
ModAskFullCanIn result_empty = new ModAskFullCanIn();
|
||
string mesJson = JsonConvert.SerializeObject(jsonData);
|
||
try
|
||
{
|
||
string robotJobId = jsonData["body"]?["event"]?["robotJobId"]?.ToString();//任务号
|
||
string agvCode = jsonData["body"]?["event"]?["agvCode"]?.ToString();//AGV编号
|
||
string pointCode = jsonData["body"]?["event"]?["pointCode"]?.ToString();//AGV点位
|
||
string state = jsonData["body"]?["event"]?["state"]?.ToString();//状态
|
||
string errorCode = jsonData["body"]?["event"]?["errorCode"]?.ToString();//错误码
|
||
string errorType = jsonData["body"]?["event"]?["errorType"]?.ToString();//错误描述
|
||
Log.WriteLog("AGV上报信息:" + mesJson);
|
||
if (
|
||
string.IsNullOrEmpty(pointCode) ||
|
||
string.IsNullOrEmpty(agvCode))
|
||
{
|
||
|
||
result_empty.data = mesJson;
|
||
result_empty.success = false;
|
||
result_empty.message = "异常,有必填项目为空";
|
||
result_empty.code = "success";
|
||
Log.WriteLog("AGV上报信息:" + result_empty);
|
||
}
|
||
else
|
||
{
|
||
//更新进数据库
|
||
if (RegisterConTainer.CreateConTainerProcess.UPDATE_T_PICK_STATUS(agvCode, robotJobId, pointCode, state, errorCode, errorType))
|
||
{
|
||
Log.WriteLog("AGV上报信息已存入表内:" + mesJson);
|
||
result_empty.data = mesJson;
|
||
result_empty.success = true;
|
||
result_empty.message = "成功";
|
||
result_empty.code = "success";
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Log.WriteLog("异常:" + ex + "实际接收内容:" + mesJson);
|
||
}
|
||
string strJson2 = JsonConvert.SerializeObject(result_empty);
|
||
HttpResponseMessage result = new HttpResponseMessage
|
||
{
|
||
Content = new StringContent(strJson2, System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
};
|
||
return result;
|
||
}
|
||
|
||
|
||
private static int _counter = 0; // 计数器,初始值为0
|
||
public static string GenerateTaskId()
|
||
{
|
||
int currentCounter = Interlocked.Increment(ref _counter);
|
||
// 如果计数器超过了最大值,则重置为0
|
||
if (currentCounter > 999999)
|
||
{
|
||
Interlocked.CompareExchange(ref _counter, 0, 999999); // 重置为0
|
||
currentCounter = 0; // 确保返回正确的ID
|
||
}
|
||
// 格式化为6位数的字符串,前面补零
|
||
string formattedNumber = currentCounter.ToString("D6");
|
||
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||
// 返回完整的TaskId
|
||
return $"{date}{formattedNumber}";
|
||
}
|
||
|
||
#endregion
|
||
|
||
//#endregion
|
||
|
||
|
||
public class MES_RESULT
|
||
{
|
||
public string resultCode { get; set; }
|
||
public string resultMessage { get; set; }
|
||
}
|
||
|
||
|
||
#region RCS-WMS 入库申请货位
|
||
//[HttpPost, Route("Api/Wms/CreateInstoreTask")]
|
||
public HttpResponseMessage CreateInstoreTask([FromBody] JObject CreateInstoreTask)
|
||
{
|
||
lock ("CreateInstoreTask")
|
||
{
|
||
JObject jo = new JObject(
|
||
new JProperty("code", ""),
|
||
new JProperty("wmstaskid", ""),
|
||
new JProperty("palletno", ""),
|
||
new JProperty("fromcellno", ""),
|
||
new JProperty("tocellno", ""),
|
||
new JProperty("message", "")
|
||
);
|
||
string mesJson = CreateInstoreTask.ToString().Trim();
|
||
mesJson = mesJson.Replace(" ", "").ToString();
|
||
Log.WriteLog("接收RCS-WMS入库申请货位:" + mesJson);
|
||
|
||
ArrayList SqlList = new ArrayList();
|
||
|
||
try
|
||
{
|
||
string strSqlAdd = "";
|
||
//string ORDER_ID = "RK" + DateTime.Now.ToString("yyyymmddhhmmsssss");
|
||
|
||
JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
string requestid = strJo["requestid"].ToString().Trim();//用户id
|
||
string key = strJo["key"].ToString().Trim();//组织id
|
||
string palletno = strJo["palletno"].ToString().Trim();//托盘号
|
||
string fromcellno = strJo["fromcellno"].ToString().Trim();//入库口
|
||
string Height = strJo["height"].ToString().Trim();//入库口
|
||
|
||
DataSet ds = RegisterConTainer.CreateConTainerProcess.Get_T_ONGOODSSHELF_Ctl(palletno);
|
||
if (ds!=null && ds.Tables[0].Rows.Count>0)
|
||
{
|
||
string ORDER_ID= ds.Tables[0].Rows[0]["LOT_ID"].ToString().Trim();
|
||
DataSet ds2 = RegisterConTainer.CreateConTainerProcess.Get_T_BASE_STORAGE_AREA_LOCATION_LOCATION_ID(Height);
|
||
if (ds2 != null && ds2.Tables[0].Rows.Count > 0)
|
||
{
|
||
string LOCATION_ID = ds2.Tables[0].Rows[0][0].ToString();//"B19-38-02";//
|
||
|
||
strSqlAdd = @"UPDATE T_BASE_STORAGE_AREA_LOCATION SET status='1' where LOCATION_ID='" + LOCATION_ID + "'";
|
||
SqlList.Add(strSqlAdd);
|
||
Log.WriteLog("接收RCS-WMS入库申请SQL:" + strSqlAdd);
|
||
strSqlAdd = @"UPDATE t_ongoodsshelf SET status='1',LOT_ID='" + ORDER_ID + "', LOCATION_ID='" + LOCATION_ID + "' where CTL='" + palletno + "'";
|
||
SqlList.Add(strSqlAdd);
|
||
Log.WriteLog("接收RCS-WMS入库申请SQL:" + strSqlAdd);
|
||
|
||
jo["code"] = "200";
|
||
jo["wmstaskid"] = ORDER_ID;
|
||
jo["palletno"] = palletno;
|
||
jo["fromcellno"] = fromcellno;
|
||
jo["tocellno"] = LOCATION_ID;
|
||
jo["message"] = "成功";
|
||
}
|
||
else
|
||
{
|
||
jo["code"] = "400";
|
||
jo["wmstaskid"] = ORDER_ID;
|
||
jo["palletno"] = palletno;
|
||
jo["fromcellno"] = fromcellno;
|
||
jo["tocellno"] = "";
|
||
jo["message"] = "无可用货位";
|
||
|
||
}
|
||
if (SqlList.Count > 0)
|
||
{
|
||
string errText = "";
|
||
if (RegisterConTainer.CreateConTainerProcess.ExecuteSqlTran(SqlList, ref errText) > 0)
|
||
{
|
||
Log.WriteLog("接收RCS-WMS入库申请货位成功:" + mesJson);
|
||
}
|
||
else
|
||
{
|
||
Log.WriteLog("接收MES物料退料:" + mesJson);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
jo["code"] = "400";
|
||
jo["wmstaskid"] = "";
|
||
jo["palletno"] = palletno;
|
||
jo["fromcellno"] = fromcellno;
|
||
jo["tocellno"] = "";
|
||
jo["message"] = "无可用货位";
|
||
|
||
Log.WriteLog("接收RCS-WMS入库申请:无可用货位" );
|
||
}
|
||
}
|
||
else
|
||
{
|
||
jo["code"] = "400";
|
||
jo["wmstaskid"] = "";
|
||
jo["palletno"] = palletno;
|
||
jo["fromcellno"] = fromcellno;
|
||
jo["tocellno"] = "";
|
||
jo["message"] = "无入库码盘任务";
|
||
Log.WriteLog("接收RCS-WMS入库申请:无入库码盘任务");
|
||
}
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
jo["code"] = "400";
|
||
jo["wmstaskid"] = "";
|
||
jo["palletno"] = "";
|
||
jo["fromcellno"] = "";
|
||
jo["tocellno"] = "";
|
||
jo["message"] = "接收RCS-WMS入库申请数据处理异常:" + ex.Message;
|
||
Log.WriteLog("接收RCS-WMS入库申请数据处理异常:" + ex.Message);
|
||
}
|
||
HttpResponseMessage result = new HttpResponseMessage
|
||
{
|
||
Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
};
|
||
return result;
|
||
}
|
||
}
|
||
#endregion
|
||
public class ModAskFullCanIn
|
||
{
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public string code { get; set; }
|
||
/// <summary>
|
||
/// 成功
|
||
/// </summary>
|
||
public string message { get; set; }
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public string data { get; set; }
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public bool success { get; set; }
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 海康回告任务完成
|
||
/// </summary>
|
||
/// <param name="agvCallback"></param>
|
||
/// <returns></returns>
|
||
//[HttpPost, Route("api/wms/agvCallback")]
|
||
//public HttpResponseMessage agvCallback([FromBody] JObject agvCallback)
|
||
//{
|
||
// string errText = string.Empty;
|
||
// ArrayList SqlList = new ArrayList();
|
||
// ModAgv mod = new ModAgv();
|
||
|
||
// string mesJson = agvCallback.ToString().ToString();
|
||
// Log.WriteLog("AGV入库任务通知已搬走或已送达:" + mesJson);
|
||
|
||
// try
|
||
// {
|
||
|
||
// JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
|
||
// string reqCode = strJo["reqCode"].ToString().Trim();//请求编号,每个请求都要一个唯一编号 根据MES入库任务号一致
|
||
// string reqTime = strJo["reqTime"].ToString();//请求时间戳
|
||
// //string clientCode = strJo["clientCode"].ToString().Trim();//客户端编号
|
||
// //string tokenCode = strJo["tokenCode"].ToString().Trim();//令牌号, 由调度系统颁发
|
||
// //string method = strJo["method"].ToString().Trim();//方法名, 可使用任务类型做为方法名
|
||
// string taskCode = strJo["taskCode"].ToString().Trim();//当前任务单号
|
||
// string posCode = strJo["currentPositionCode"].ToString().Trim();//出库口102
|
||
|
||
// //string posCode = strA.Substring(strA.Length-2).ToString().Trim();
|
||
|
||
// //string lot = strJo["materialLot"].ToString().Trim();//lot
|
||
// string currentCallCode = strJo["currentCallCode"].ToString().Trim();//当前到达的机台编号
|
||
// string podCode = strJo["podCode"].ToString().Trim() + "ID";//托盘号
|
||
|
||
// string taskTyp = "";// strJo["taskTyp"].ToString().Trim();
|
||
|
||
// JObject strJoData = (JObject)JsonConvert.DeserializeObject(strJo["data"].ToString());
|
||
// string lot = strJoData["lot"].ToString().Trim();//lot
|
||
// string qty = "";// strJoData["qty"].ToString().Trim();//数量
|
||
// string nextspec = "";// strJoData["nextspec"].ToString().Trim();//规格
|
||
// string materialCode = strJoData["materialCode"].ToString().Trim();//物料编号
|
||
|
||
|
||
// if (currentCallCode == "201")
|
||
// {
|
||
// if (RegisterConTainer.CreateConTainerProcess.Get_T_ONGOODSSHELF(taskCode))
|
||
// {
|
||
// //更新任务状态为2
|
||
// string Sql = " update T_ONGOODSSHELF set status='2' where LOT_ID='" + taskCode + "'";
|
||
// if (RegisterConTainer.CreateConTainerProcess.Add_Table(Sql, ref errText))
|
||
// {
|
||
// mod.resultCode = "0";
|
||
// mod.resultMsg = "托盘送达入库口更新入库任务状态成功,reqCode=" + reqCode + ",taskCode=" + taskCode + ",入库口编号:" + posCode + ",托盘号:" + podCode;
|
||
|
||
// Log.WriteLog("托盘送达入库口更新入库任务状态成功,reqCode=" + reqCode + ",taskCode=" + taskCode + ",入库口编号:" + posCode + ",托盘号:" + podCode);
|
||
// }
|
||
// else
|
||
// {
|
||
// mod.resultCode = "-1";
|
||
// mod.resultMsg = "托盘送达入库口更新入库任务状态异常,任务号:" + reqCode + ",taskCode=" + taskCode + ",异常:" + errText;
|
||
|
||
// Log.WriteLog("托盘送达入库口更新入库任务状态异常,任务号:" + reqCode + ",taskCode=" + taskCode + ",异常:" + errText);
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// mod.resultCode = "-1";
|
||
// mod.resultMsg = "已产生入库,不能重复:" + reqCode + ",taskCode=" + taskCode;
|
||
|
||
// Log.WriteLog("已产生入库,不能重复:" + reqCode + ",taskCode=" + taskCode);
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// //出库成功更新任务状态为9
|
||
// RegisterConTainer.CreateConTainerProcess.UpdateCKTaskStatus10();
|
||
// mod.resultCode = "0";
|
||
// mod.resultMsg = "taskCode=" + taskCode + ",出库成功,currentCallCode=" + currentCallCode;
|
||
|
||
// Log.WriteLog("taskCode=" + taskCode + ",出库成功,currentCallCode=" + currentCallCode);
|
||
// }
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// mod.resultCode = "-1";
|
||
// mod.resultMsg = "AGV入库任务通知已搬走或已送达异常:" + ex.Message.ToString();
|
||
|
||
// Log.WriteLog("AGV入库任务通知已搬走或已送达异常" + ex.Message.ToString());
|
||
// }
|
||
// string strJson2 = JsonConvert.SerializeObject(mod);
|
||
// HttpResponseMessage result = new HttpResponseMessage
|
||
// {
|
||
// Content = new StringContent(strJson2, System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
// };
|
||
// return result;
|
||
|
||
|
||
//}
|
||
|
||
/// <summary>
|
||
/// 海康查询是否允许放货
|
||
/// </summary>
|
||
/// <param name="agvCallarrive"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("api/wms/agvCallarrive")]
|
||
public HttpResponseMessage agvCallarrive([FromBody] JObject agvCallarrive)
|
||
{
|
||
string errText = string.Empty;
|
||
ArrayList SqlList = new ArrayList();
|
||
ModAgv mod = new ModAgv();
|
||
string mesJson = agvCallarrive.ToString().Trim();
|
||
//mesJson = mesJson.Replace(" ", "").ToString();
|
||
Log.WriteLog("RCS请求询问WMS满托是否可入json:" + mesJson);
|
||
|
||
try
|
||
{
|
||
JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
string reqCode = strJo["reqCode"].ToString().Trim();//请求编号,每个请求都要一个唯一编号
|
||
string reqTime = strJo["reqTime"].ToString().Trim();//请求时间戳
|
||
//string clientCode = strJo["clientCode"].ToString().Trim();//客户端编号
|
||
//string tokenCode = strJo["tokenCode"].ToString().Trim();//令牌号, 由调度系统颁发
|
||
//string lot = strJo["lot"].ToString().Trim();//
|
||
string posCode = strJo["currentPositionCode"].ToString().Trim();//接驳位置编号: 入库口101,出库口201
|
||
//string carrier = strJo["carrier"].ToString().Trim();//
|
||
string taskCode = strJo["taskCode"].ToString().Trim();
|
||
string podCode = strJo["podCode"].ToString().Trim();//托盘号
|
||
|
||
|
||
|
||
JObject strJoData = (JObject)JsonConvert.DeserializeObject(strJo["data"].ToString());
|
||
string lot = strJoData["lot"].ToString().Trim();//批次号
|
||
string goodsId = strJoData["materialCode"].ToString().Trim();//物料编号
|
||
string qty = "";// strJoData["qty"].ToString().Trim();//批次数量
|
||
//查询当前站台是否有货,有货不允许放,无货可以放
|
||
if(RegisterConTainer.CreateConTainerProcess.STAND_STATUS_HK(posCode, taskCode, taskCode))
|
||
{
|
||
if (RegisterConTainer.CreateConTainerProcess.Get_T_SSX_HK())
|
||
{
|
||
mod.resultCode = "0";
|
||
mod.resultMsg = "RCS询问WMS满托是否可入成功:";
|
||
|
||
Log.WriteLog("RCS询问WMS满托是否可入成功");
|
||
}
|
||
else
|
||
{
|
||
mod.resultCode = "1";
|
||
mod.resultMsg = "RCS询问WMS满托是否可入失败";
|
||
|
||
Log.WriteLog("RCS询问WMS满托是否可入失败");
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
mod.resultCode = "1";
|
||
mod.resultMsg = "RCS询问WMS满托是否可入异常:" + ex.Message.ToString();
|
||
|
||
Log.WriteLog("RCS询问WMS满托是否可入异常" + ex.Message.ToString());
|
||
}
|
||
string strJson2 = JsonConvert.SerializeObject(mod);
|
||
HttpResponseMessage result = new HttpResponseMessage
|
||
{
|
||
Content = new StringContent(strJson2, System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
};
|
||
return result;
|
||
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// AGV任务完成
|
||
/// </summary>
|
||
/// <param name="task"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("robotjob.report")]
|
||
public HttpResponseMessage Exception([FromBody] JObject jsonData)
|
||
{
|
||
|
||
string errText = string.Empty;
|
||
ArrayList SqlList = new ArrayList();
|
||
ModAskFullCanIn result_empty = new ModAskFullCanIn();
|
||
string mesJson = JsonConvert.SerializeObject(jsonData);
|
||
try
|
||
{
|
||
string robotJobId = jsonData["body"]?["event"]?["robotJobId"]?.ToString();
|
||
string endSlotCode = jsonData["body"]?["event"]?["jobData"]?["endSlotCode"]?.ToString();
|
||
string startSlotCode = jsonData["body"]?["event"]?["jobData"]?["startSlotCode"]?.ToString();
|
||
string state = jsonData["body"]?["event"]?["state"]?.ToString();
|
||
Log.WriteLog("KC-WMS上报任务完成:" + mesJson);
|
||
if (string.IsNullOrEmpty(robotJobId) ||
|
||
string.IsNullOrEmpty(endSlotCode) ||
|
||
string.IsNullOrEmpty(startSlotCode))
|
||
{
|
||
|
||
result_empty.data = mesJson;
|
||
result_empty.success = false;
|
||
result_empty.message = "异常,有必填项目为空";
|
||
result_empty.code = "success";
|
||
Log.WriteLog("KC-WMS上报任务完成异常:" + result_empty);
|
||
}
|
||
else
|
||
{
|
||
if (endSlotCode == "4002-1-01-001"&& state == "DONE")
|
||
{
|
||
//完成的是出库任务
|
||
if (
|
||
RegisterConTainer.CreateConTainerProcess.UPDATE_T_PICK_BOXID(robotJobId) &&
|
||
RegisterConTainer.CreateConTainerProcess.UPDATE_T_CK_PICKINGWAVEGOODS_3(robotJobId) &&
|
||
RegisterConTainer.CreateConTainerProcess.UPDATE_T_BASE_STORAGE_AREA_LOCATION_STATUS(startSlotCode)
|
||
)
|
||
{
|
||
Log.WriteLog("任务状态,库位状态,库存更新成功:" + mesJson);
|
||
result_empty.data = mesJson;
|
||
result_empty.success = true;
|
||
result_empty.message = "成功";
|
||
result_empty.code = "success";
|
||
}
|
||
}
|
||
else if(startSlotCode == "4001-1-01-001" && state == "DONE")
|
||
{
|
||
if (RegisterConTainer.CreateConTainerProcess.UPDATE_T_T_ONGOODSSHELF_6(robotJobId))
|
||
{
|
||
Log.WriteLog("任务状态更新成3(完成)成功" + mesJson);
|
||
result_empty.data = mesJson;
|
||
result_empty.success = true;
|
||
result_empty.message = "成功";
|
||
result_empty.code = "success";
|
||
}
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Log.WriteLog("异常:" + ex +"实际接收内容:"+ mesJson);
|
||
}
|
||
string strJson2 = JsonConvert.SerializeObject(result_empty);
|
||
HttpResponseMessage result = new HttpResponseMessage
|
||
{
|
||
Content = new StringContent(strJson2, System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
};
|
||
return result;
|
||
}
|
||
|
||
|
||
|
||
|
||
[HttpPost, Route("rollejob.upstreamrequest")]
|
||
public HttpResponseMessage Exception_DOWN([FromBody] JObject jsonData)
|
||
{
|
||
|
||
string errText = string.Empty;
|
||
ArrayList SqlList = new ArrayList();
|
||
ModAskFullCanIn result_empty = new ModAskFullCanIn();
|
||
string mesJson = JsonConvert.SerializeObject(jsonData);
|
||
try
|
||
{
|
||
string robotJobId = jsonData["body"]?["event"]?["robotJobId"]?.ToString();
|
||
string msgld= jsonData["body"]?["event"]?["msgId"]?.ToString();
|
||
string agvCode = jsonData["body"]?["event"]?["agvCode"]?.ToString();
|
||
Log.WriteLog("KC-WMS申请卸货请求:" + mesJson);
|
||
|
||
|
||
if (string.IsNullOrEmpty(robotJobId))
|
||
{
|
||
result_empty.data = mesJson;
|
||
result_empty.success = false;
|
||
result_empty.message = "异常,有必填项目为空";
|
||
result_empty.code = "success";
|
||
Log.WriteLog("KC-WMS申请卸货异常:" + result_empty);
|
||
}
|
||
else
|
||
{
|
||
if (RegisterConTainer.CreateConTainerProcess.STAND_STATUS_CK(agvCode, robotJobId, msgld))
|
||
{
|
||
if (RegisterConTainer.CreateConTainerProcess.STAND_STATUS())
|
||
{
|
||
result_empty.data = mesJson;
|
||
result_empty.success = true;
|
||
result_empty.message = "success";
|
||
result_empty.code = "success";
|
||
Log.WriteLog("KC-WMS申请卸货允许:" + result_empty);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
result_empty.data = mesJson;
|
||
result_empty.success = false;
|
||
result_empty.message = "success";
|
||
result_empty.code = "success";
|
||
Log.WriteLog("KC-WMS申请卸货不允许:" + result_empty);
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Log.WriteLog("异常:" + ex + "实际接收内容:" + mesJson);
|
||
}
|
||
string strJson2 = JsonConvert.SerializeObject(result_empty);
|
||
HttpResponseMessage result = new HttpResponseMessage
|
||
{
|
||
Content = new StringContent(strJson2, System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
};
|
||
return result;
|
||
}
|
||
|
||
|
||
|
||
|
||
[HttpPost, Route("api/wms/agvCallback")]
|
||
public HttpResponseMessage agvCallback([FromBody] JObject agvCallback)
|
||
{
|
||
string errText = string.Empty;
|
||
ArrayList SqlList = new ArrayList();
|
||
ModAgv mod = new ModAgv();
|
||
|
||
string mesJson = agvCallback.ToString().ToString();
|
||
Log.WriteLog("AGV入库任务通知已搬走或已送达:" + mesJson);
|
||
|
||
try
|
||
{
|
||
JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
|
||
string reqCode = strJo["reqCode"].ToString().Trim();//请求编号,每个请求都要一个唯一编号 根据MES入库任务号一致
|
||
string reqTime = strJo["reqTime"].ToString();//请求时间戳
|
||
|
||
string taskCode = strJo["taskCode"].ToString().Trim();//当前任务单号
|
||
string posCode = strJo["currentPositionCode"].ToString().Trim();//出库口102
|
||
|
||
string currentCallCode = strJo["currentCallCode"].ToString().Trim();//当前到达的机台编号
|
||
string podCode = strJo["podCode"].ToString().Trim() + "ID";//托盘号
|
||
|
||
string taskTyp = "";// strJo["taskTyp"].ToString().Trim();
|
||
|
||
JObject strJoData = (JObject)JsonConvert.DeserializeObject(strJo["data"].ToString());
|
||
string lot = strJoData["lot"].ToString().Trim();//lot
|
||
string qty = "";// strJoData["qty"].ToString().Trim();//数量
|
||
string nextspec = "";// strJoData["nextspec"].ToString().Trim();//规格
|
||
string materialCode = strJoData["materialCode"].ToString().Trim();//物料编号
|
||
|
||
if (currentCallCode == "201")
|
||
{
|
||
//入库任务
|
||
if (RegisterConTainer.CreateConTainerProcess.UPDATE_ONGOODS_HK_2(taskCode))
|
||
{
|
||
mod.resultCode = "0";
|
||
mod.resultMsg = "托盘送达入库口更新入库任务状态成功,reqCode=" + reqCode + ",taskCode=" + taskCode + ",入库口编号:" + posCode + ",托盘号:" + podCode;
|
||
|
||
Log.WriteLog("托盘送达入库口更新入库任务状态成功,reqCode=" + reqCode + ",taskCode=" + taskCode + ",入库口编号:" + posCode + ",托盘号:" + podCode);
|
||
}
|
||
}
|
||
else if(currentCallCode == "201_1")
|
||
{
|
||
mod.resultCode = "0";
|
||
mod.resultMsg = "托盘请求进入入库口成功,reqCode=" + reqCode + ",taskCode=" + taskCode + ",入库口编号:" + posCode + ",托盘号:" + podCode;
|
||
Log.WriteLog("托盘请求进入入库口成功,reqCode=" + reqCode + ",taskCode=" + taskCode + ",入库口编号:" + posCode + ",托盘号:" + podCode);
|
||
}
|
||
else if (currentCallCode == "202")
|
||
{
|
||
//出库任务
|
||
if (RegisterConTainer.CreateConTainerProcess.UPDATE_ONGOODS_CK_2(taskCode))
|
||
{
|
||
mod.resultCode = "0";
|
||
mod.resultMsg = "托盘送达入库口更新入库任务状态成功,reqCode=" + reqCode + ",taskCode=" + taskCode + ",入库口编号:" + posCode + ",托盘号:" + podCode;
|
||
|
||
Log.WriteLog("托盘送达入库口更新入库任务状态成功,reqCode=" + reqCode + ",taskCode=" + taskCode + ",入库口编号:" + posCode + ",托盘号:" + podCode);
|
||
}
|
||
}
|
||
else if(currentCallCode == "202_1")
|
||
{
|
||
mod.resultCode = "0";
|
||
mod.resultMsg = "托盘请求出库口进入成功,reqCode=" + reqCode + ",taskCode=" + taskCode + ",入库口编号:" + posCode + ",托盘号:" + podCode;
|
||
|
||
Log.WriteLog("托盘请求出库口进入成功,reqCode=" + reqCode + ",taskCode=" + taskCode + ",入库口编号:" + posCode + ",托盘号:" + podCode);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Log.WriteLog("异常:" + ex + "实际接收内容:" + mesJson);
|
||
}
|
||
string strJson2 = JsonConvert.SerializeObject(mod);
|
||
HttpResponseMessage result = new HttpResponseMessage
|
||
{
|
||
Content = new StringContent(strJson2, System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
};
|
||
return result;
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
public class ModAgv
|
||
{
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
public string resultCode { get; set; }
|
||
/// <summary>
|
||
/// 成功
|
||
/// </summary>
|
||
public string resultMsg { get; set; }
|
||
|
||
|
||
}
|
||
|
||
|
||
#region RCS-WMS 任务执行状态通知
|
||
[HttpPost, Route("Api/Wms/TaskStateNotice")]
|
||
public HttpResponseMessage TaskStateNotice([FromBody] JObject TaskStateNotice)
|
||
{
|
||
lock ("TaskStateNotice")
|
||
{
|
||
JObject jo = new JObject(
|
||
new JProperty("code", ""),
|
||
new JProperty("wmstaskid", ""),
|
||
new JProperty("message", "")
|
||
);
|
||
string mesJson = TaskStateNotice.ToString().Trim();
|
||
mesJson = mesJson.Replace(" ", "").ToString();
|
||
Log.WriteLog("接收RCS-WMS任务执行状态通知:" + mesJson);
|
||
|
||
ArrayList SqlList = new ArrayList();
|
||
|
||
try
|
||
{
|
||
string strSqlAdd = "";
|
||
JObject strJo = (JObject)JsonConvert.DeserializeObject(mesJson);
|
||
string requestid = strJo["requestid"].ToString().Trim();//用户id
|
||
string key = strJo["key"].ToString().Trim();//组织id
|
||
string wmstaskid = strJo["wmstaskid"].ToString().Trim();//任务号
|
||
string taskstate = strJo["taskstate"].ToString().Trim();////20表示执行成功,21表示取消
|
||
|
||
DataSet ds = RegisterConTainer.CreateConTainerProcess.Get_t_ongoodsshelf_TASK (wmstaskid);
|
||
if (ds != null && ds.Tables[0].Rows.Count > 0)
|
||
{
|
||
Log.WriteLog("接收RCS-WMS任务执行状态通知-入库任务,WMS任务号:" + wmstaskid+",查询成功.");
|
||
|
||
if (taskstate == "20")
|
||
{
|
||
|
||
if (RegisterConTainer.CreateConTainerProcess.UPDATE_t_ongoodsshelf_UPGOODS_ID(wmstaskid))
|
||
{
|
||
Log.WriteLog("接收RCS-WMS任务执行状态通知-入库任务执行成功,WMS任务号:" + wmstaskid + ",更新入库表t_ongoodsshelf 状态2成功.");
|
||
jo["code"] = "200";
|
||
jo["wmstaskid"] = wmstaskid;
|
||
jo["message"] = "成功";
|
||
}
|
||
else
|
||
{
|
||
Log.WriteLog("接收RCS-WMS任务执行状态通知-入库任务执行成功,WMS任务号:" + wmstaskid + ",更新入库表t_ongoodsshelf 状态2失败.");
|
||
jo["code"] = "400";
|
||
jo["wmstaskid"] = wmstaskid;
|
||
jo["message"] = "失败";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (RegisterConTainer.CreateConTainerProcess.UPDATE_t_ongoodsshelf_Cancel(wmstaskid))
|
||
{
|
||
Log.WriteLog("接收RCS-WMS任务执行状态通知-入库任务执行取消,WMS任务号:" + wmstaskid + ",更新入库表t_ongoodsshelf 状态0成功.");
|
||
jo["code"] = "200";
|
||
jo["wmstaskid"] = wmstaskid;
|
||
jo["message"] = "成功";
|
||
}
|
||
else
|
||
{
|
||
Log.WriteLog("接收RCS-WMS任务执行状态通知-入库任务执行取消,WMS任务号:" + wmstaskid + ",更新入库表t_ongoodsshelf 状态0失败.");
|
||
jo["code"] = "400";
|
||
jo["wmstaskid"] = wmstaskid;
|
||
jo["message"] = "失败";
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
|
||
DataSet ds2= RegisterConTainer.CreateConTainerProcess.Get_T_CK_PICKINGWAVEGOODS(wmstaskid);
|
||
if (ds2 != null && ds2.Tables[0].Rows.Count > 0)
|
||
{
|
||
Log.WriteLog("接收RCS-WMS任务执行状态通知-出库任务,WMS任务号:" + wmstaskid + ",查询成功.");
|
||
|
||
if (taskstate == "20")
|
||
{
|
||
|
||
if (RegisterConTainer.CreateConTainerProcess.UPDATE_T_CK_PICKINGWAVEGOODS_OUT_ID(wmstaskid,"2"))
|
||
{
|
||
Log.WriteLog("接收RCS-WMS任务执行状态通知-出库任务执行成功,WMS任务号:" + wmstaskid + ",更新入库表T_CK_PICKINGWAVEGOODS 状态2成功.");
|
||
jo["code"] = "200";
|
||
jo["wmstaskid"] = wmstaskid;
|
||
jo["message"] = "成功";
|
||
}
|
||
else
|
||
{
|
||
Log.WriteLog("接收RCS-WMS任务执行状态通知-出库任务执行成功,WMS任务号:" + wmstaskid + ",更新入库表T_CK_PICKINGWAVEGOODS 状态2失败.");
|
||
jo["code"] = "400";
|
||
jo["wmstaskid"] = wmstaskid;
|
||
jo["message"] = "失败";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (RegisterConTainer.CreateConTainerProcess.UPDATE_T_CK_PICKINGWAVEGOODS_OUT_ID(wmstaskid,"0"))
|
||
{
|
||
Log.WriteLog("接收RCS-WMS任务执行状态通知-出库任务执行取消,WMS任务号:" + wmstaskid + ",更新入库表T_CK_PICKINGWAVEGOODS 状态0成功.");
|
||
jo["code"] = "200";
|
||
jo["wmstaskid"] = wmstaskid;
|
||
jo["message"] = "成功";
|
||
}
|
||
else
|
||
{
|
||
Log.WriteLog("接收RCS-WMS任务执行状态通知-出库任务执行取消,WMS任务号:" + wmstaskid + ",更新入库表t_ongoodsshelf 状态0失败.");
|
||
jo["code"] = "400";
|
||
jo["wmstaskid"] = wmstaskid;
|
||
jo["message"] = "失败";
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Log.WriteLog("接收RCS-WMS任务执行状态通知,WMS任务号:" + wmstaskid + ",wms系统不存在");
|
||
jo["code"] = "200";
|
||
jo["wmstaskid"] = wmstaskid;
|
||
jo["message"] = "任务号" + wmstaskid + "不存在";
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
|
||
//if (SqlList.Count > 0)
|
||
//{
|
||
// string errText = "";
|
||
// if (RegisterConTainer.CreateConTainerProcess.ExecuteSqlTran(SqlList, ref errText) > 0)
|
||
// {
|
||
// Log.WriteLog("接收RCS-WMS入库申请货位成功:" + mesJson);
|
||
// }
|
||
// else
|
||
// {
|
||
// Log.WriteLog("接收MES物料退料:" + mesJson);
|
||
// }
|
||
//}
|
||
//else
|
||
//{
|
||
// jo["code"] = "400";
|
||
// jo["wmstaskid"] = wmstaskid;
|
||
// jo["message"] = "任务号" + wmstaskid + "不存在";
|
||
//}
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
jo["code"] = "400";
|
||
jo["wmstaskid"] = "";
|
||
jo["palletno"] = "";
|
||
jo["fromcellno"] = "";
|
||
jo["tocellno"] = "";
|
||
jo["message"] = "接收RCS-WMS入库申请数据处理异常:" + ex.Message;
|
||
Log.WriteLog("接收RCS-WMS入库申请数据处理异常" + ex.Message);
|
||
}
|
||
HttpResponseMessage result = new HttpResponseMessage
|
||
{
|
||
Content = new StringContent(jo.ToString(), System.Text.Encoding.GetEncoding("UTF-8"), "application/json")
|
||
};
|
||
return result;
|
||
}
|
||
|
||
|
||
}
|
||
#endregion
|
||
|
||
|
||
#endregion
|
||
|
||
|
||
}
|
||
}
|
||
#endregion |