liudl
2025-01-20 48d66a079c307356997fb400d27907ff6d363b7b
修改2楼分拣和1楼拆垛时获取拆垛信息接口
7个文件已修改
107 ■■■■■ 已修改文件
Admin.NET/WCS.Application/Entity/WcsBoxInfoLog.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Model/TaskRequest.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/PLC/PLCCommon.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/PLC/PLCService.cs 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/PLC/PLCTaskAction.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Util/HttpService.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Entity/WcsBoxInfoLog.cs
@@ -121,5 +121,11 @@
    /// </summary>
    [SugarColumn(ColumnName = "Level", ColumnDescription = "包装级别", Length = 3)]
    public string? Level { get; set; }
    /// <summary>
    /// 包装数量
    /// </summary>
    [SugarColumn(ColumnName = "QtyCount", ColumnDescription = "包装数量", Length = 3)]
    public int? QtyCount { get; set; }
}
Admin.NET/WCS.Application/Model/TaskRequest.cs
@@ -483,9 +483,9 @@
public class RequestBoxInfoCheckAll
{
    public string Success { get; set; }
    public int Success { get; set; }
    public string Message { get; set; }
    public List<RequestBoxInfoCheck> list { get; set; }
    public List<RequestBoxInfoCheck> data { get; set; }
}
public class RequestBoxInfoCheck
{
@@ -545,3 +545,23 @@
    /// </summary>
    public string loadingAddre { get; set; }
}
public class FumaJiepiModel
{
    /// <summary>
    /// 物料编码
    /// </summary>
    public string SkuNo { get; set; }
    /// <summary>
    /// 物料名称
    /// </summary>
    public string SkuName { get; set; }
    /// <summary>
    /// 批次号
    /// </summary>
    public string LotNo { get; set; }
    /// <summary>
    /// 完工数量
    /// </summary>
    public string FinishQty { get; set; }
}
Admin.NET/WCS.Application/OpenApi/DemoOpenApi.cs
@@ -1,4 +1,5 @@
using DocumentFormat.OpenXml.Presentation;
using Dm.filter;
using DocumentFormat.OpenXml.Presentation;
using Elastic.Clients.Elasticsearch;
using Furion.Logging;
using Newtonsoft.Json;
@@ -178,6 +179,7 @@
                        Qty = item.Qty,
                        TaskType = (TaskTypeEnum)item.TaskType,
                        CreateTime = DateTime.Now,
                        Status = TaskStatusEnum.Wait,
                    };
                    _db.Insertable(orderAdd).ExecuteCommand();
               //}
@@ -350,34 +352,45 @@
    /// <summary>
    /// WCS接受赋码系统推送的结批总数量
    /// </summary>
    /// <param name="models">箱码信息</param>
    /// <param name="models">结批数量信息</param>
    /// <returns>反馈信息</returns>
    [HttpPost]
    [AllowAnonymous]
    public ResponseFuMaModel HttpTotalNum(FumaBoxInfoInput models)
    public ResponseFuMaModel HttpTotalNum(FumaJiepiModel models)
    {
        try
        {
            string str = JsonConvert.SerializeObject(models);
            Log.Information("接收赋码推送的结批总数量:" + str);
            var num = _db.Queryable<WcsBoxInfo>().Where(m => m.BoxNo == models.BoxNo && m.IsDelete == false).ToList();
            if (num.Count > 0)
            Log.Information("接收赋码推送的完工结批总数量:" + str);
            //查看赋码下发的任务信息是否正在分拣
            var num = _db.Queryable<WcsCheckTask>().Where(m => m.SkuNo == models.SkuNo &&m.LotNo == models.LotNo && m.Status == "1").ToList();
            if (num.Count < 1)
            {
                //WCS存在箱码信息,更新箱码信息(需判断箱码是否已组盘入库)
                var num2 = num.Count(m => m.Status != "0" || !string.IsNullOrWhiteSpace(m.PalletNo));
                if (num2 > 0)
                {
                    throw new Exception("该箱已盘入库,不可更新信息");
                }
            }
            if (num.Count == 0)
            {
                throw new Exception("未找到该箱码,箱码移除失败!");
                return new ResponseFuMaModel() { Success = "-1", Message = "该批次未进行分拣或已结批" };
            }
            _db.Deleteable(num).ExecuteCommand();
            return new ResponseFuMaModel() { Success = "0", Message = "移除箱码成功" };
            //获取包装数量
            int Fqty = int.Parse(models.FinishQty);
            var boxinfolog = _db.Queryable<WcsBoxInfoLog>().Where(m => m.SkuNo == models.SkuNo && m.LotNo == models.LotNo && m.BitBoxMark == "0").First();
            if (boxinfolog == null)
            {
                var boxinfo = _db.Queryable<WcsBoxInfo>().Where(m => m.SkuNo == models.SkuNo && m.LotNo == models.LotNo && m.BitBoxMark == "0").First();
                Fqty = (int)(Fqty /boxinfo.QtyCount);
            }
            else
            {
                Fqty = (int)(Fqty / boxinfolog.QtyCount);
            }
            //写入该任务完成数量
            foreach (var item in num)
            {
                item.FinishQty = Fqty;
            }
            _db.Updateable(num).ExecuteCommand();
            return new ResponseFuMaModel() { Success = "0", Message = "接受完工结批数量成功" };
        }
        catch (Exception ex)
        {
Admin.NET/WCS.Application/PLC/PLCCommon.cs
@@ -24,7 +24,7 @@
    public static PlcTaskInfo GetCTaskInfo(string endLocat,string taskType,string roadWay,string endRoadWay) 
    {
        // 各层输送线跺机放货工位集合
        var conveyList1 = new List<string>() { "033", "039", "044", "051", "059" };
        var conveyList1 = new List<string>() { "033", "039", "044", "051", "059","009" };
        var conveyList2 = new List<string>() { "205", "234" };
        var conveyList3 = new List<string>() { "440", "443" };
@@ -330,7 +330,7 @@
    {
        startStation = startStation.PadLeft(3, '0');
        string strIp = "";
        var conveyList1 = new List<string>() { "147", "145", "139", "137", "129", "127", "121", "119", "111", "109", "103", "101", "093", "091", "085", "083", "075", "073", "067", "065","033","039","044" ,"051","059"};
        var conveyList1 = new List<string>() { "147", "145", "139", "137", "129", "127", "121", "119", "111", "109", "103", "101", "093", "091", "085", "083", "075", "073", "067", "065","033","039","044" ,"051","059","009"};
        var conveyList2 = new List<string>() { "205", "234", "252", "254", "260", "262", "270", "272", "278", "280", "288", "290", "294", "301", "307", "309", "315", "317", "325", "327", "331", "337" };
        var conveyList3 = new List<string>() { "401", "402", "405", "406", "409", "410", "413", "414", "417", "418", "421", "422", "425", "426", "429", "430", "433", "434", "437", "438", "440", "443" };
        if (conveyList1.Contains(startStation))
Admin.NET/WCS.Application/PLC/PLCService.cs
@@ -2237,6 +2237,7 @@
                            }
                            var rowCount = _db.Updateable(boxInfo).ExecuteCommand();
                            Log.Information(string.Format("插码成功,箱码是:"+ boxNo, modDevice.StationNum));
                            if (rowCount > 0)
                            {
                                // 插码成功
@@ -2381,12 +2382,12 @@
                                    }
                                    break;
                                }
                                // 组托成功后将信息存到log表
                                string sqlStr = $"insert into WCSBoxInfoLog select * from WCSBoxInfo where IsDelete=0 and PalletNo='{palletNo}'";
                                int insertCount = _db.Ado.ExecuteCommand(sqlStr);
                                if (insertCount > 0)
                                {
                                    // 组托成功后将信息存到log表
                                    string sqlStr2 = $"delete from WCSBoxInfoLog where  IsDelete=0 and PalletNo='{palletNo}'";
                                    string sqlStr2 = $"delete from WCSBoxInfo where  IsDelete=0 and PalletNo='{palletNo}'";
                                    _db.Ado.ExecuteCommand(sqlStr2);
                                }
                                
@@ -2487,7 +2488,7 @@
    private static void StackingRobot(WcsDeviceDto modDevice)
    {
        var plcConn = modDevice.PLCUtil;
        if (modDevice.DbNumber == "DB131" && modDevice.DbNumber == "DB132" && modDevice.DbNumber == "DB133" && modDevice.DbNumber == "DB134")
        if (modDevice.DbNumber == "DB131" || modDevice.DbNumber == "DB132" || modDevice.DbNumber == "DB133" || modDevice.DbNumber == "DB134")
        {
            switch (modDevice.Value.ToString())
            {
@@ -2507,7 +2508,7 @@
                        // 根据任务号获取任务信息
                        if (res1.IsSucceed)
                        {
                            var modTask = _db.Queryable<WcsTask>().First(m => m.Status == TaskStatusEnum.Doing && m.TaskNo == tasknoVal && m.EndLocate == "009" && m.IsDelete == false);
                            var modTask = _db.Queryable<WcsTask>().First(m => m.TaskNo == tasknoVal && m.EndLocate == "009" && m.IsDelete == false);
                            if (modTask == null)
                            {
                                Log.Error(string.Format($"出库任务未下发,请人工处理,无法拆垛!"));
@@ -2517,22 +2518,22 @@
                            //通过任务号和托盘号向WMS申请此托盘的拆垛信息
                            var http = new HttpService();
                            RequestBoxInfoCheckAll tasklist = http.RequestBoxCheckinfo(palletVal, tasknoVal);
                            if (!tasklist.Success.Contains("-1"))
                            if (tasklist.Success != -1)
                            {
                                //获取拆垛物料品种(需要增加物料判断,同一个物料号可能会出现不同的码垛规则)
                                var pz = _db.Queryable<WcsMateialPzInfo>().First(m => m.SkuNo == tasklist.list[0].SkuNo);
                                var pz = _db.Queryable<WcsMateialPzInfo>().First(m => m.SkuNo == tasklist.data[0].SkuNo);
                                //下发拆托规格,拆箱数和托盘上总箱数(不绑定机器人,拆垛任务信息只下发一次)
                                // 给PLC写入任务数据
                                var listResult = new List<Result>();
                                // 获取托盘规则
                                var Standard = modDevice.listStation.FirstOrDefault(m => m.Text == "规格");
                                listResult.Add(plcConn.SetPlcDBValue(Standard.PosType, modDevice.DbNumber, Standard.PlcPos, tasklist.list[0].Standard));
                                listResult.Add(plcConn.SetPlcDBValue(Standard.PosType, modDevice.DbNumber, Standard.PlcPos, pz.PZNo));
                                //抓箱数
                                var qty = modDevice.listStation.FirstOrDefault(m => m.Text == "拆箱数量");
                                listResult.Add(plcConn.SetPlcDBValue(qty.PosType, modDevice.DbNumber, qty.PlcPos, tasklist.list[0].Qty.ToString()));
                                listResult.Add(plcConn.SetPlcDBValue(qty.PosType, modDevice.DbNumber, qty.PlcPos, tasklist.data[0].Qty.ToString()));
                                //总箱数
                                var qtycount = modDevice.listStation.FirstOrDefault(m => m.Text == "总箱数");
                                listResult.Add(plcConn.SetPlcDBValue(qtycount.PosType, modDevice.DbNumber, qtycount.PlcPos, tasklist.list[0].QtyCount.ToString()));
                                listResult.Add(plcConn.SetPlcDBValue(qtycount.PosType, modDevice.DbNumber, qtycount.PlcPos, tasklist.data[0].QtyCount.ToString()));
                                // 是否写入成功
Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
@@ -72,7 +72,7 @@
        // var strMsg = new HttpService().RequestPackWcs("LN000001");
        cts.Cancel();
        listPlc = _db.Queryable<WcsPlc>()
            .Where(s => s.Type == PLCTypeEnum.StackingMachine || s.Type == PLCTypeEnum.ConveyorLine || s.Type == PLCTypeEnum.BoxConveyorLine)
            .Where(s => s.Type == PLCTypeEnum.StackingMachine || s.Type == PLCTypeEnum.ConveyorLine || s.Type == PLCTypeEnum.BoxConveyorLine || s.Type == PLCTypeEnum.StackingRobot)
            .Where(s => s.Enable == YesNoEnum.Y)
            .ToList();
        listPlcDevice = _db.Queryable<WcsDevice>().ToList();
Admin.NET/WCS.Application/Util/HttpService.cs
@@ -137,6 +137,7 @@
                _db.Insertable(taskAdd).ExecuteCommand();
                endLocat = result.TaskList.EndRoadway;
                returnStr = result.TaskList.EndLocate;
                taskNo = result.TaskList.TaskNo;
            }
            else
            {