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.
318 lines
14 KiB
318 lines
14 KiB
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using XS_DAL;
|
|
using XS_Model;
|
|
|
|
namespace XS_BLL
|
|
{
|
|
public class SPLIT_MATERIAL_BLL
|
|
{
|
|
#region 全局参数
|
|
/// <summary>
|
|
/// 接口地址,请求路径
|
|
/// </summary>
|
|
//public static string InterfaceAdd = Global.upper_WMSURL + "api/wcs/container/pallet";//请求路径 BarCodeApplyConfirm
|
|
public static string InterfaceAdd = Global.upper_WMSURL + "StackApplyConfirm";//请求路径 BarCodeApplyConfirm
|
|
/// <summary>
|
|
/// 接口名称,接口日志文件名
|
|
/// </summary>
|
|
public static string InterfaceName = "StackApplyConfirm";
|
|
/// <summary>
|
|
/// 接口描述
|
|
/// </summary>
|
|
public static string InterfaceNote = "备料完成上报";
|
|
/// <summary>
|
|
/// 接口流向
|
|
/// </summary>
|
|
public static string InterfaceFlow = "WCS==>>WMS";
|
|
/// <summary>
|
|
/// 请求JSON
|
|
/// </summary>
|
|
public static string reqJson = string.Empty;
|
|
/// <summary>
|
|
/// 反馈JSON
|
|
/// </summary>
|
|
public static string retJson = string.Empty;
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 码垛完成上报
|
|
/// </summary>
|
|
public static void SPLIT_MATERIAL()
|
|
{
|
|
IO_CONTROL model = new IO_CONTROL();
|
|
|
|
IO_CONTROL_APPLY caModel = new IO_CONTROL_APPLY();
|
|
List<IO_CONTROL_APPLY> caModleList = new List<IO_CONTROL_APPLY>();
|
|
|
|
SPLIT_MATERIAL_MODEL mpModel = new SPLIT_MATERIAL_MODEL();
|
|
|
|
ZH_pallet zhpModel = new ZH_pallet();
|
|
try
|
|
{
|
|
//未分配码货端口
|
|
int[] port = new int[] { 12007 };
|
|
caModleList = caModel.GetModelList(" APPLY_TASK_STATUS = 0 and CONTROL_APPLY_TYPE = 18 and DEVICE_CODE in(" + string.Join(",", port) + ")");
|
|
|
|
foreach (var item in caModleList)
|
|
{
|
|
try
|
|
{
|
|
if (!string.IsNullOrEmpty(item.STOCK_BARCODE))
|
|
{
|
|
string STOCK_BARCODE = item.STOCK_BARCODE.Length >= 7 ? item.STOCK_BARCODE.Substring(0, 7) : item.STOCK_BARCODE;
|
|
|
|
#region reqJson
|
|
|
|
JObject objMis = new JObject();
|
|
//objMis.Add(new JProperty("taskId", UtilityBLL.GetUuid()));//接口交互 任务号 谁发起,谁生成
|
|
objMis.Add(new JProperty("taskId", DateTime.Now.ToString("yyyyMMddHHmmss")));//接口交互 任务号
|
|
//objMis.Add(new JProperty("taskNo", item.taskNo));// task 任务号,使用申请表的任务索引
|
|
//objMis.Add(new JProperty("subTaskNo", item.subTaskNo));// task 任务号,使用申请表的任务索引
|
|
objMis.Add(new JProperty("taskNo", ""));
|
|
objMis.Add(new JProperty("subTaskNo", ""));
|
|
objMis.Add(new JProperty("pointCode", item.DEVICE_CODE));//资源点
|
|
objMis.Add(new JProperty("containerCode", item.STOCK_BARCODE.Trim()));//托盘码
|
|
objMis.Add(new JProperty("qty", Convert.ToInt32(item.CONTROL_APPLY_PARAMETER.Split(',').Length)));//托盘上存放数量
|
|
objMis.Add(new JProperty("list", item.CONTROL_APPLY_PARAMETER.Split(',')));//商品条码 集合
|
|
|
|
objMis.Add(new JProperty("originalContainerCode", item.CONTROL_APPLY_REMARK));//原托盘码
|
|
|
|
reqJson = JsonConvert.DeserializeObject(objMis.ToString()).ToString();
|
|
#endregion
|
|
|
|
retJson = HttpHelper.PostJson(InterfaceAdd, reqJson);
|
|
bool success = Convert.ToBoolean(UtilityBLL.GetReceiveValues(retJson, "success"));
|
|
string retdata = UtilityBLL.GetReceiveValues(retJson, "data");
|
|
string dataVerify = string.Empty;
|
|
if (success)
|
|
{
|
|
List<SPLIT_MATERIAL_MODEL> paModelList = JsonConvert.DeserializeObject<List<SPLIT_MATERIAL_MODEL>>(retdata);
|
|
|
|
foreach (var item2 in paModelList)
|
|
{
|
|
|
|
mpModel = item2;
|
|
#region 数据赋值
|
|
|
|
string retEx = string.Empty;
|
|
|
|
#region add 修改人:yy 修改时间:2024年3月3日 原因/内容:添加数据验证
|
|
if (string.IsNullOrEmpty(mpModel.taskNo))
|
|
{
|
|
dataVerify += "任务号不能为空;";
|
|
}
|
|
if (string.IsNullOrEmpty(mpModel.subTaskNo))
|
|
{
|
|
dataVerify += "子任务号不能为空;";
|
|
}
|
|
if (string.IsNullOrEmpty(mpModel.fromLocatorCode))
|
|
{
|
|
dataVerify += "原位置点不能为空";
|
|
}
|
|
if (string.IsNullOrEmpty(mpModel.toLocatorCode))
|
|
{
|
|
dataVerify += "目标位置不能为空";
|
|
}
|
|
if (string.IsNullOrEmpty(mpModel.containerCode))
|
|
{
|
|
//dataVerify += "托盘条码不能为空";
|
|
}
|
|
if ((mpModel.ifNotWrapper != "0" && mpModel.ifNotWrapper != "1") || (mpModel.ifNotWrapper.ToUpper() != "TRUE" && mpModel.ifNotWrapper.ToUpper() != "FALSE"))
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
dataVerify += "是否缠膜状态不正确;";
|
|
}
|
|
if (mpModel.error != true && mpModel.error != false)
|
|
{
|
|
dataVerify += "是否异常状态不正确;";
|
|
}
|
|
//数据验证异常,跳出当前循环
|
|
if (!string.IsNullOrEmpty(dataVerify))
|
|
{//返回数据异常
|
|
UtilityBLL.CreateINTERFACE_LOG(InterfaceName, InterfaceFlow, reqJson, dataVerify + retJson, InterfaceNote);
|
|
continue;
|
|
}
|
|
#endregion
|
|
|
|
model = new IO_CONTROL();
|
|
model.CONTROL_ID = Convert.ToString(UtilityBLL.GetTempManageIdx());
|
|
model.RELATIVE_CONTROL_ID = -1;
|
|
model.MANAGE_ID = Convert.ToDecimal(mpModel.subTaskNo);
|
|
model.STOCK_BARCODE = STOCK_BARCODE;//SN 码 未码垛前当 托盘码用
|
|
model.MANAGE_TASK_TYPE = "1";
|
|
model.CONTROL_TASK_TYPE = 4;//1:入库 2:出库 3:倒库 4:托盘移动/盘点
|
|
model.CONTROL_TASK_LEVEL = "1";
|
|
model.START_WAREHOUSE_CODE = "1";
|
|
model.END_WAREHOUSE_CODE = "1";
|
|
model.WORK_MODE = mpModel.ifNotWrapper;//工作模式:0 缠膜,1不缠膜
|
|
model.CONTROL_STATUS = 0;
|
|
model.GOODS_PATTERN_CODE = "0";
|
|
model.CONTROL_REMARK = mpModel.taskNo;
|
|
//model.ERROR_TEXT = "";
|
|
model.CONTROL_BEGIN_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
model.taskflag = 18;
|
|
model.START_DEVICE_CODE = mpModel.fromLocatorCode;
|
|
model.END_DEVICE_CODE = mpModel.toLocatorCode;
|
|
|
|
//model.GOODS_NUM = mpModel.GOODS_NUM;// 拆包数量
|
|
if (mpModel.error || success == false)
|
|
{
|
|
model.END_DEVICE_CODE = string.IsNullOrEmpty(mpModel.toLocatorCode) ? "19002" : mpModel.toLocatorCode;
|
|
model.WORK_MODE = "1";
|
|
|
|
}
|
|
model.Insert(out retEx);
|
|
|
|
|
|
#endregion 数据赋值
|
|
caModel.Update(" APPLY_TASK_STATUS = 1 ", " CONTROL_APPLY_ID = '" + item.CONTROL_APPLY_ID + "'");
|
|
caModel.Delete(" CONTROL_APPLY_ID = '" + item.CONTROL_APPLY_ID + "'");
|
|
}
|
|
}
|
|
else if (success == false)
|
|
{
|
|
//PUBLIC_BLL.errDischarge(item.DEVICE_CODE, "19002", "4", STOCK_BARCODE);
|
|
//caModel.Update(" APPLY_TASK_STATUS = 1 ", " CONTROL_APPLY_ID = '" + item.CONTROL_APPLY_ID + "'");
|
|
}
|
|
#region 添加接口日志 及界面显示
|
|
UtilityBLL.CreateINTERFACE_LOG(InterfaceName, InterfaceFlow, reqJson, retJson + dataVerify, InterfaceNote);
|
|
#endregion
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
new DisplaySet().ErrorAddListBoxItem(InterfaceName, ex.Message);
|
|
new DisplaySet().AddListBoxItem(InterfaceName, ex.Message);
|
|
|
|
UtilityBLL.CreateINTERFACE_LOG(InterfaceName, InterfaceFlow, reqJson, ex.Message, InterfaceNote);
|
|
|
|
LogHelper.ErrorLog(ex);
|
|
}
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
|
|
throw;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 码垛完成上报 返回实体类
|
|
/// </summary>
|
|
public class SPLIT_MATERIAL_MODEL
|
|
{
|
|
/// <summary>
|
|
/// 任务号
|
|
/// </summary>
|
|
public string taskNo { get; set; }
|
|
/// <summary>
|
|
/// 任务描述
|
|
/// </summary>
|
|
public string taskDescr { get; set; }
|
|
/// <summary>
|
|
/// 源位置点
|
|
/// </summary>
|
|
public string fromLocatorCode { get; set; }
|
|
/// <summary>
|
|
/// 目标位置点
|
|
/// </summary>
|
|
public string toLocatorCode { get; set; }
|
|
/// <summary>
|
|
/// 托盘条码
|
|
/// </summary>
|
|
public string containerCode { get; set; }
|
|
/// <summary>
|
|
/// 路径编码
|
|
/// </summary>
|
|
public string lineCode { get; set; }
|
|
/// <summary>
|
|
/// 是否缠膜 true 缠膜;false 缠膜
|
|
/// </summary>
|
|
public string ifNotWrapper { get; set; }
|
|
/// <summary>
|
|
/// 是否异常
|
|
/// </summary>
|
|
public bool error { get; set; }
|
|
/// <summary>
|
|
/// 子任务号
|
|
/// </summary>
|
|
public string subTaskNo { get; set; }
|
|
/// <summary>
|
|
/// 任务ID
|
|
/// </summary>
|
|
public long taskId { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// SN码
|
|
/// </summary>
|
|
public string productUniqueCode { get; set; }
|
|
/// <summary>
|
|
/// 是否质检
|
|
/// </summary>
|
|
public int ifTestingRandom { get; set; }
|
|
/// <summary>
|
|
/// 物料编码
|
|
/// </summary>
|
|
public string productCode { get; set; }
|
|
/// <summary>
|
|
/// 物料名称
|
|
/// </summary>
|
|
public string productName { get; set; }
|
|
/// <summary>
|
|
/// 物料长
|
|
/// </summary>
|
|
public string packingLength { get; set; }
|
|
/// <summary>
|
|
/// 物料宽
|
|
/// </summary>
|
|
public string packingWidth { get; set; }
|
|
/// <summary>
|
|
/// 物料高
|
|
/// </summary>
|
|
public string packinghigh { get; set; }
|
|
/// <summary>
|
|
/// 物料码托排
|
|
/// </summary>
|
|
public string palletArrangePlatoon { get; set; }
|
|
/// <summary>
|
|
/// 物料码托列
|
|
/// </summary>
|
|
public string palletArrangeLie { get; set; }
|
|
/// <summary>
|
|
/// 物料码托层
|
|
/// </summary>
|
|
public string palletArrangeStorey { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public string pointCode { get; set; }
|
|
public int stats { get; set; }
|
|
public string taskType { get; set; }
|
|
public string fromRoadwayCode { get; set; }
|
|
public string fromStorey { get; set; }
|
|
public string fromPlatoon { get; set; }
|
|
|
|
public string fromLie { get; set; }
|
|
public int fromLocatorCodeDepth { get; set; }
|
|
public string toRoadwayCode { get; set; }
|
|
public string toStorey { get; set; }
|
|
public string toPlatoon { get; set; }
|
|
public string toLie { get; set; }
|
|
public int toLocatorDepth { get; set; }
|
|
public int taskGroupPriority { get; set; }
|
|
|
|
public int taskPriority { get; set; }
|
|
}
|
|
}
|
|
}
|