You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
319 lines
16 KiB
319 lines
16 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Security;
|
|
using System.ServiceModel;
|
|
using System.ServiceModel.Description;
|
|
using Newtonsoft.Json;
|
|
using SSWMS.Common;
|
|
|
|
namespace SSWMS.Server
|
|
{
|
|
[ServiceBehavior(IncludeExceptionDetailInFaults = true, InstanceContextMode = InstanceContextMode.Single,
|
|
ConcurrencyMode = ConcurrencyMode.Multiple, MaxItemsInObjectGraph = int.MaxValue, UseSynchronizationContext = false)]
|
|
public class S_ERPService : I_ERPService
|
|
{
|
|
//public S_ERPService()
|
|
//{
|
|
// ser = new ERPService.I_ERPServiceClient();
|
|
//}
|
|
//public ERPService.I_ERPServiceClient ser = null;
|
|
|
|
public bool FireAlarm(string CELL_CODE, string Alarm_Type, out string sResult)
|
|
{
|
|
sResult = string.Empty;
|
|
try
|
|
{
|
|
S_BaseService._P_SYS_LOG.Add(new SYS_LOG()
|
|
{
|
|
OPERATOR = "WMS",
|
|
LOG_TYPE = "烟感温感",
|
|
LOG_TIME = StringUtils.GetCurrentTime(),
|
|
LOG_TEXT = string.Format("货位编码 {0} 报警标志 {1} 结果 {2}", CELL_CODE, Alarm_Type, sResult)
|
|
});
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sResult = ex.Message;
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public bool ERPInterface(RECORD_MAIN rm, out string sResult)
|
|
{
|
|
try
|
|
{
|
|
if (rm.MANAGE_STATUS == SystemCode.MANAGE_STATUS.Complete ||
|
|
rm.MANAGE_STATUS == SystemCode.MANAGE_STATUS.Delete)
|
|
{
|
|
sResult = $"托盘条码 {rm.STOCK_BARCODE} 任务状态错误";
|
|
return false;
|
|
}
|
|
bool bResult = true;
|
|
sResult = string.Empty;
|
|
string positionPlace = rm.END_POSITION;
|
|
WH_CELL wc = null;
|
|
switch (rm.MANAGE_TYPE)
|
|
{
|
|
case SystemCode.MANAGE_TYPE.InCell:
|
|
wc = S_BaseService._P_WH_CELL.GetModelByCellCode(rm.END_POSITION);
|
|
if (wc != null)
|
|
{
|
|
positionPlace = wc.CELL_NAME;
|
|
}
|
|
bResult = WebRequest.Post(WebRequest.ERPUrl + $"positionConfirm?locationId={WebRequest.LocationID}&salverNumber={rm.STOCK_BARCODE}&positionPlace={positionPlace}", null, out sResult);
|
|
break;
|
|
case SystemCode.MANAGE_TYPE.MoveCell:
|
|
wc = S_BaseService._P_WH_CELL.GetModelByCellCode(rm.END_POSITION);
|
|
if (wc != null)
|
|
{
|
|
positionPlace = wc.CELL_NAME;
|
|
}
|
|
bResult = WebRequest.Post(WebRequest.ERPUrl + $"positionMove?locationId={WebRequest.LocationID}&salverNumber={rm.STOCK_BARCODE}&positionPlace={positionPlace}", null, out sResult);
|
|
break;
|
|
case SystemCode.MANAGE_TYPE.OutCell:
|
|
case SystemCode.MANAGE_TYPE.OutPick:
|
|
if (rm.PLAN_ID == 0)
|
|
{
|
|
bResult = WebRequest.Post(WebRequest.ERPUrl + $"manuallyPicKing?locationId={WebRequest.LocationID}&salverNumber={rm.STOCK_BARCODE}", null, out sResult);
|
|
}
|
|
else
|
|
{
|
|
PLAN_MAIN pm = S_BaseService._P_PLAN_MAIN.GetModel(rm.PLAN_ID);
|
|
if (pm != null)
|
|
{
|
|
bResult = WebRequest.Post(WebRequest.ERPUrl + $"takeOffShelf?locationId={WebRequest.LocationID}&salverNumber={rm.STOCK_BARCODE}&pickingNo={pm.PLAN_CODE}&status=0&statusMsg=Success", null, out sResult);
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
try
|
|
{
|
|
S_BaseService._P_Base_House.BeginTransaction();
|
|
rm.MANAGE_STATUS = SystemCode.MANAGE_STATUS.Complete;
|
|
rm.ERROR_TEXT = string.Empty;
|
|
if (bResult)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(sResult))
|
|
{
|
|
ResponseDataERP responseData = JsonConvert.DeserializeObject<ResponseDataERP>(sResult);
|
|
if (responseData == null)
|
|
{
|
|
rm.MANAGE_STATUS = SystemCode.MANAGE_STATUS.Error;
|
|
rm.ERROR_TEXT = "空报文";
|
|
}
|
|
else if (responseData.code != 200)
|
|
{
|
|
rm.MANAGE_STATUS = SystemCode.MANAGE_STATUS.Error;
|
|
rm.ERROR_TEXT = responseData.message;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
rm.MANAGE_STATUS = SystemCode.MANAGE_STATUS.Error;
|
|
rm.ERROR_TEXT = sResult;
|
|
}
|
|
S_BaseService._P_RECORD_MAIN.Update(rm);
|
|
S_BaseService._P_Base_House.CommitTransaction();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
S_BaseService._P_Base_House.RollBackTransaction();
|
|
sResult = ex.Message;
|
|
return false;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sResult = ex.Message;
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public List<STORAGE_LIST> ERPGetBarCode(string sStockBarcode, out string sResult)
|
|
{
|
|
sResult = string.Empty;
|
|
try
|
|
{
|
|
//if (!AppSettings.IsNetworkDeployed)
|
|
//{
|
|
// List<STORAGE_LIST> lStorageList = new List<STORAGE_LIST>();
|
|
// if (sStockBarcode.StartsWith("0"))
|
|
// {
|
|
// lStorageList.Add(new STORAGE_LIST
|
|
// {
|
|
// GOODS_ID = SystemCode.GOODS_ID.Goods,
|
|
// GOODS_BARCODE = sStockBarcode,
|
|
// STORAGE_PROPERTY_01 = "1",
|
|
// STORAGE_PROPERTY_02 = "2",
|
|
// STORAGE_PROPERTY_03 = "3",
|
|
// STORAGE_PROPERTY_04 = "4",
|
|
// STORAGE_PROPERTY_05 = "5",
|
|
// STORAGE_PROPERTY_06 = "6",
|
|
// STORAGE_PROPERTY_07 = "7",
|
|
// STORAGE_PROPERTY_08 = "8",
|
|
// // salverType STOCK_HEIGHT 0 高托 1 低托
|
|
// STORAGE_PROPERTY_09 = SystemCode.STOCK_HEIGHT.Low,
|
|
// // towerType STOCK_SIZE 0 方托盘 1 长托盘
|
|
// STORAGE_PROPERTY_10 = SystemCode.STOCK_SIZE.Square,
|
|
// STORAGE_PROPERTY_11 = "2024",
|
|
// STORAGE_PROPERTY_12 = "12",
|
|
// STORAGE_LIST_QUANTITY = 1
|
|
// });
|
|
// }
|
|
// else if (sStockBarcode.StartsWith("1"))
|
|
// {
|
|
// lStorageList.Add(new STORAGE_LIST
|
|
// {
|
|
// GOODS_ID = SystemCode.GOODS_ID.Goods,
|
|
// GOODS_BARCODE = sStockBarcode,
|
|
// STORAGE_PROPERTY_01 = "1",
|
|
// STORAGE_PROPERTY_02 = "2",
|
|
// STORAGE_PROPERTY_03 = "3",
|
|
// STORAGE_PROPERTY_04 = "4",
|
|
// STORAGE_PROPERTY_05 = "5",
|
|
// STORAGE_PROPERTY_06 = "6",
|
|
// STORAGE_PROPERTY_07 = "7",
|
|
// STORAGE_PROPERTY_08 = "8",
|
|
// // salverType STOCK_HEIGHT 0 高托 1 低托
|
|
// STORAGE_PROPERTY_09 = SystemCode.STOCK_HEIGHT.High,
|
|
// // towerType STOCK_SIZE 0 方托盘 1 长托盘
|
|
// STORAGE_PROPERTY_10 = SystemCode.STOCK_SIZE.Rectangle,
|
|
// STORAGE_PROPERTY_11 = "2024",
|
|
// STORAGE_PROPERTY_12 = "12",
|
|
// STORAGE_LIST_QUANTITY = 1
|
|
// });
|
|
// }
|
|
// else if (sStockBarcode.StartsWith("2"))
|
|
// {
|
|
// lStorageList.Add(new STORAGE_LIST
|
|
// {
|
|
// GOODS_ID = SystemCode.GOODS_ID.Goods,
|
|
// GOODS_BARCODE = sStockBarcode,
|
|
// STORAGE_PROPERTY_01 = "1",
|
|
// STORAGE_PROPERTY_02 = "2",
|
|
// STORAGE_PROPERTY_03 = "3",
|
|
// STORAGE_PROPERTY_04 = "4",
|
|
// STORAGE_PROPERTY_05 = "5",
|
|
// STORAGE_PROPERTY_06 = "6",
|
|
// STORAGE_PROPERTY_07 = "7",
|
|
// STORAGE_PROPERTY_08 = "8",
|
|
// // salverType STOCK_HEIGHT 0 高托 1 低托
|
|
// STORAGE_PROPERTY_09 = SystemCode.STOCK_HEIGHT.High,
|
|
// // towerType STOCK_SIZE 0 方托盘 1 长托盘
|
|
// STORAGE_PROPERTY_10 = SystemCode.STOCK_SIZE.Square,
|
|
// STORAGE_PROPERTY_11 = "2024",
|
|
// STORAGE_PROPERTY_12 = "12",
|
|
// STORAGE_LIST_QUANTITY = 1
|
|
// });
|
|
// lStorageList.Add(new STORAGE_LIST
|
|
// {
|
|
// GOODS_ID = SystemCode.GOODS_ID.Goods,
|
|
// GOODS_BARCODE = sStockBarcode.Replace('2', '3'),
|
|
// STORAGE_PROPERTY_01 = "1",
|
|
// STORAGE_PROPERTY_02 = "2",
|
|
// STORAGE_PROPERTY_03 = "3",
|
|
// STORAGE_PROPERTY_04 = "4",
|
|
// STORAGE_PROPERTY_05 = "5",
|
|
// STORAGE_PROPERTY_06 = "6",
|
|
// STORAGE_PROPERTY_07 = "7",
|
|
// STORAGE_PROPERTY_08 = "8",
|
|
// // salverType STOCK_HEIGHT 0 高托 1 低托
|
|
// STORAGE_PROPERTY_09 = SystemCode.STOCK_HEIGHT.Low,
|
|
// // towerType STOCK_SIZE 0 方托盘 1 长托盘
|
|
// STORAGE_PROPERTY_10 = SystemCode.STOCK_SIZE.Square,
|
|
// STORAGE_PROPERTY_11 = "2024",
|
|
// STORAGE_PROPERTY_12 = "12",
|
|
// STORAGE_LIST_QUANTITY = 1
|
|
// });
|
|
// }
|
|
// else
|
|
// {
|
|
// sResult = "未找到库存";
|
|
// }
|
|
// return lStorageList;
|
|
//}
|
|
if (WebRequest.Post(WebRequest.ERPUrl + $"getBarCode?locationId={WebRequest.LocationID}&salverNumber={sStockBarcode}", null, out sResult))
|
|
{
|
|
ResponseDataERP data = JsonConvert.DeserializeObject<ResponseDataERP>(sResult);
|
|
if (data != null && data.code == 200)
|
|
{
|
|
if (data.data == null)
|
|
{
|
|
sResult = "接口出参错误";
|
|
return null;
|
|
}
|
|
GetBarCodeData getBarCodeData = JsonConvert.DeserializeObject<GetBarCodeData>(data.data.ToString());
|
|
if (getBarCodeData == null)
|
|
{
|
|
sResult = "接口出参错误";
|
|
return null;
|
|
}
|
|
List<STORAGE_LIST> lStorageList = new List<STORAGE_LIST>()
|
|
{
|
|
new STORAGE_LIST
|
|
{
|
|
GOODS_ID = SystemCode.GOODS_ID.Goods,
|
|
GOODS_BARCODE = sStockBarcode,
|
|
STORAGE_PROPERTY_01 = getBarCodeData.productCode,
|
|
STORAGE_PROPERTY_02 = getBarCodeData.productName,
|
|
STORAGE_PROPERTY_03 = getBarCodeData.productLevel,
|
|
STORAGE_PROPERTY_04 = getBarCodeData.packageType,
|
|
STORAGE_PROPERTY_05 = getBarCodeData.customerCode,
|
|
STORAGE_PROPERTY_06 = getBarCodeData.customerName,
|
|
STORAGE_PROPERTY_07 = getBarCodeData.netWeight,
|
|
STORAGE_PROPERTY_08 = getBarCodeData.roughWeight,
|
|
// salverType STOCK_HEIGHT 0 高托 1 低托
|
|
STORAGE_PROPERTY_09 = getBarCodeData.salverType == "0" ? SystemCode.STOCK_HEIGHT.High : SystemCode.STOCK_HEIGHT.Low,
|
|
// towerType STOCK_SIZE 0 方托盘 1 长托盘
|
|
STORAGE_PROPERTY_10 = getBarCodeData.towerType == "0" ? SystemCode.STOCK_SIZE.Square : SystemCode.STOCK_SIZE.Rectangle,
|
|
STORAGE_PROPERTY_11 = string.IsNullOrWhiteSpace(getBarCodeData.inTime) ? string.Empty : new DateTime(621356256000000000 + Convert.ToInt64(getBarCodeData.inTime) * TimeSpan.TicksPerMillisecond).ToString("yyyy-MM-dd HH:mm:ss"),
|
|
STORAGE_PROPERTY_12 = string.Empty,
|
|
STORAGE_LIST_QUANTITY = 1
|
|
}
|
|
};
|
|
if (data.data1 != null)
|
|
{
|
|
GetBarCodeData getBarCodeData1 = JsonConvert.DeserializeObject<GetBarCodeData>(data.data1.ToString());
|
|
if (getBarCodeData1 != null)
|
|
{
|
|
lStorageList.Add(new STORAGE_LIST()
|
|
{
|
|
GOODS_ID = SystemCode.GOODS_ID.Goods,
|
|
GOODS_BARCODE = sStockBarcode,
|
|
STORAGE_PROPERTY_01 = getBarCodeData1.productCode,
|
|
STORAGE_PROPERTY_02 = getBarCodeData1.productName,
|
|
STORAGE_PROPERTY_03 = getBarCodeData1.productLevel,
|
|
STORAGE_PROPERTY_04 = getBarCodeData1.packageType,
|
|
STORAGE_PROPERTY_05 = getBarCodeData1.customerCode,
|
|
STORAGE_PROPERTY_06 = getBarCodeData1.customerName,
|
|
STORAGE_PROPERTY_07 = getBarCodeData1.netWeight,
|
|
STORAGE_PROPERTY_08 = getBarCodeData1.roughWeight,
|
|
// salverType STOCK_HEIGHT 0 高托 1 低托
|
|
STORAGE_PROPERTY_09 = getBarCodeData1.salverType,
|
|
// towerType STOCK_SIZE 0 方托盘 1 长托盘
|
|
STORAGE_PROPERTY_10 = getBarCodeData1.towerType == "0" ? SystemCode.STOCK_SIZE.Square : SystemCode.STOCK_SIZE.Rectangle,
|
|
STORAGE_PROPERTY_11 = string.IsNullOrWhiteSpace(getBarCodeData.inTime) ? string.Empty : new DateTime(621356256000000000 + Convert.ToInt64(getBarCodeData.inTime) * TimeSpan.TicksPerMillisecond).ToString("yyyy-MM-dd HH:mm:ss"),
|
|
STORAGE_PROPERTY_12 = string.Empty,
|
|
STORAGE_LIST_QUANTITY = 1
|
|
});
|
|
}
|
|
}
|
|
return lStorageList;
|
|
}
|
|
else
|
|
{
|
|
sResult = data.message;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
sResult = ex.Message;
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
}
|