using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace HH.WCS.Mobox3.DSZSH.api {
public class ApiModel {
///
/// Mobox 接口返回数据类
///
public class SimpleResult {
public int resultCode { get; set; }
public string resultMsg { get; set; }
public List result { get; set; } = new List();
}
///
/// 构建 返回值
///
///
///
///
public static SimpleResult NewSimpleResult(int code, string message) {
return new SimpleResult { resultCode = code, resultMsg = message };
}
///
/// 构建 异常返回值,选择打印异常日志信息(默认打印)
///
///
///
///
///
public static SimpleResult BuildSimpleEx(Exception ex, int exCode = 1, bool pringLog = true) {
if (pringLog) {
LogHelper.InfoEx(ex);
}
return new SimpleResult { resultCode = exCode, resultMsg = ex.Message };
}
///
/// HostToAGV 上报任务状态
///
public class AgvTaskState {
///
/// AGV 回报状态号
///
public int state { get; set; }
///
/// 任务号
///
public string task_no { get; set; }
///
/// AGV 车号
///
public string forklift_no { get; set; }
///
/// 安全门编号
///
public string lock_no { get; set; }
///
/// 附加信息
///
public string ext_data { get; set; }
}
public class SafetyInteractionInfo {
public int station_id { get; set; }
///
/// 请求上线/下线的的站台库位名称,例如work6、work8
///
public string station_name { get; set; }
///
/// 请求码
///
public string apply_code { get; set; }
public string task_no { set; get; }
}
///
/// 返回给 HostToAgv
///
public class ReturnResult {
public int ResultCode { get; set; }
public string ResultMsg { get; set; }
}
public class orderStatusReportParme {
///
/// 订单ID
///
public int orderID { get; set; }
///
/// 订单名
///
public string orderName { get; set; }
///
/// 订单状态
///
public string orderStatus { get; set; }
///
/// agv车号列表
///
public string agvIDList { get; set; }
///
/// 优先级
///
public string priority { get; set; }
///
/// 订单当前的目的地
///
public string currentDes { get; set; }
///
/// 当前指令
///
public string currentCmd { get; set; }
///
/// 错误码
///
public int errorCode { get; set; }
///
/// 订单的截至时间
///
public string deadLine { get; set; }
///
/// 订单的创建时间
///
public string createdTime { get; set; }
///
/// 额外信息1
///
public string extraInfo1 { get; set; }
///
/// 额外信息2
///
public string extraInfo2 { get; set; }
}
///
/// 返回给GZ
///
public class GzResult {
public int resultCode { get; set; }
public string msg { get; set; }
public int orderID { get; set; }
}
}
public class OtherModel {
#region PDA 数据
///
/// 好运箱-满托下线入库(PDA)数据类
///
public class GoodpackOfflineInfo {
///
/// 物料编码
///
public string s_item_code { get; set; }
/////
///// 物料名称
/////
//[JsonProperty("item_name")]
//public string ItemName { get; set; }
///
/// 批次号
///
public string s_batch { get; set; }
///
/// 物料规格
///
public string s_spec { get; set; }
///
/// 数量
///
public int n_num { get; set; }
///
/// 起点货位信息
///
public string s_start_loc { get; set; }
}
///
/// 空托/空箱入库绑定(PDA)数据类
///
public class EmptyBindInfo {
///
/// 容器编码
///
[JsonProperty("s_cntr_code")]
public string CntrCode { get; set; }
///
/// 容器类型
///
[JsonProperty("s_cntr_type")]
public string CntrType { get; set; }
/////
///// 托盘数量(仅当容器类型为托盘时使用)
/////
//[JsonProperty("pallet_count", NullValueHandling = NullValueHandling.Ignore)]
//public int PalletCount { get; set; }
///
/// 货位编码
///
[JsonProperty("s_loc_code")]
public string LocCode { get; set; }
}
///
/// 空托绑定
///
public class EmptyBindPalletInfo {
///
/// 容器编码
///
public string CntrCode { get; set; }
///
/// 托盘数量
///
public int PalletCount { get; set; }
///
/// 货位编码
///
public string LocCode { get; set; }
}
///
/// 空箱绑定
///
public class EmptyBindGoodpackInfo {
///
/// 容器编码
///
public string CntrCode { get; set; }
///
/// 货位编码
///
public string LocCode { get; set; }
}
///
/// 空托/空箱入库(PDA)数据类
///
public class EmptyInboundInfo {
///
/// 容器编码
///
[JsonProperty("cntr_code")]
public string CntrCode { get; set; }
///
/// 容器类型
///
[JsonProperty("cntr_type")]
public string CntrType { get; set; }
///
/// 终点库区编码
///
[JsonProperty("end_area")]
public string EndArea { get; set; }
///
/// 起点货位
///
[JsonProperty("start_loc")]
public string StartLoc { get; set; }
}
public class EmptyInboundDetailInfo { }
//public class EmptyOnlineInfo {
// public string ItemCode { get; set; }
// public string ItemName { get; set; }
// public string PatchNo { get; set; }
// public string EndLoc { get; set; }
//}
public class EmptyOnlinePalletInfo {
///
/// 物料编码
///
[JsonProperty("item_code")]
public string ItemCode { get; set; }
/////
///// 物料名称
/////
//
//[JsonProperty("item_name")]
//public string ItemName { get; set; }
///
/// 批次号
///
[JsonProperty("batch_no")]
public string BatchNo { get; set; }
///
/// 物料规格
///
[JsonProperty("spe")]
public string Spe { get; set; }
///
/// 容器编码
///
[JsonProperty("cnt_id")]
public string CntId { get; set; }
// 容器类型 = 托盘
}
public class EmptyOnlineGoodpackInfo {
// 容器类型 = 好运箱
///
/// 容器编码
///
[JsonProperty("cnt_id")]
public string CntId { get; set; }
}
///
/// 抽检-创建抽检单(WMS)数据类
///
public class CreateCheckOrderInfo {
///
/// 物料编码
///
[JsonProperty("item_code")]
public string ItemCode { get; set; }
/////
///// 物料名称
/////
//
//[JsonProperty("item_name")]
//public string ItemName { get; set; }
///
/// 物料规格
///
[JsonProperty("spe")]
public string Spe { get; set; }
///
/// 批次号
///
[JsonProperty("batch_no")]
public string BatchNo { get; set; }
///
/// 需出库数量
///
[JsonProperty("qty")]
public int Qty { get; set; }
///
/// 容器类型
///
[JsonProperty("cntr_type")]
public string CntrType { get; set; }
///
/// 出库终点货区
///
[JsonProperty("end_area")]
public string EndArea { get; set; }
}
///
/// 抽检-合格回库(PDA) 数据类
///
public class QualifiedBackInfo {
///
/// 物料编码
///
[JsonProperty("item_code")]
public string ItemCode { get; set; }
///
/// 容器编码
///
[JsonProperty("cntr_code")]
public string CntrCode { get; set; }
}
public class UnqualifiedShiftInfo : QualifiedBackInfo {
///
/// 不合格移库终点库区
///
[JsonProperty("end_area")]
public string EndArea { get; set; }
}
public class CheckShiftInfo : UnqualifiedShiftInfo {
public bool Qualified { get; set; }
}
#endregion
#region WMS 数据
///
/// 成品胶出库(PDA)
///
public class FinishedOutboundInfo {
///
/// 物料编码
///
[JsonProperty("item_code")]
public string ItemCode { get; set; }
/////
///// 物料名称
/////
//[JsonProperty("item_name")]
//public string ItemName { get; set; }
///
/// 物料规格
///
[JsonProperty("spe")]
public string Spe { get; set; }
///
/// 批次号
///
[JsonProperty("batch_no")]
public string BatchNo { get; set; }
///
/// 需出库数量
///
[JsonProperty("qty")]
public int Qty { get; set; }
///
/// 容器类型
///
[JsonProperty("cntr_type")]
public string CntrType { get; set; }
///
/// 出库终点货区
///
[JsonProperty("end_area")]
public string EndArea { get; set; }
///
/// 是否强制出库
///
[JsonProperty("force_out")]
public bool ForcedOut { get; set; }
}
///
/// 移库-创建移库任务数据类
///
public class CreateShiftOrderInfo {
///
/// 物料编码
///
[JsonProperty("item_code")]
public string ItemCode { get; set; }
/////
///// 物料名称
/////
//
//[JsonProperty("item_name")]
//public string ItemName { get; set; }
///
/// 批次号
///
[JsonProperty("batch_no")]
public string BatchNo { get; set; }
///
/// 移库终点货区
///
[JsonProperty("end_area")]
public string EndArea { get; set; }
}
///
/// 余料尾箱回库(PDA)数据类
///
public class RestBackInfo {
///
/// 起点货位
///
[JsonProperty("start_loc")]
public string StartLoc { get; set; }
}
#endregion
///
/// 物料信息下发同步 数据类
///
public class CgInfoSyncInfo {
///
/// 物料名称
///
[JsonProperty("itemName")]
public string ItemName { get; set; }
///
/// 产品牌号
///
[JsonProperty("itemCode")]
public string ItemCode { get; set; }
///
/// 批次号
///
[JsonProperty("batchNo")]
public string BatchNo { get; set; }
///
/// 执行标准
///
[JsonProperty("standard")]
public string Standard { get; set; }
///
/// 净含量
///
[JsonProperty("netWeight")]
public string NetWeight { get; set; }
///
/// 质量等级
///
[JsonProperty("qualityGrade")]
public string QualityGrade { get; set; }
}
///
/// MES API 响应结果类
///
public class WmsResult {
///
/// 接口调用结果 1-成功 0-失败
///
[JsonProperty("result")]
public int Result { get; set; }
///
/// 是否成功 True-成功,False:失败
///
[JsonProperty("success")]
public bool Success { get; set; }
///
/// 这里是string类型,对结果的描述
///
[JsonProperty("data")]
public string Data { get; set; }
}
public static WmsResult MesResultBuilder(int code, string message = "", bool printLog = true) {
if (printLog && string.IsNullOrEmpty(message)) {
LogHelper.Info(message);
}
return new WmsResult {
Result = code,
Success = code == 0, // 仅当code=0时,success=true
Data = message,
};
}
}
}