zhaowc
2025-02-28 157abc191c34e57c1b958ae74fc3de6518ca8a30
Wms/WMS.BLL/BllCheckServer/StockCheckServer.cs
@@ -995,7 +995,7 @@
                                }
                            }
                            //生成盘点记录
                            //生成盘点记录
                            Db.Insertable(logList).ExecuteCommand();
                        }
                        // 储位号
@@ -1383,19 +1383,26 @@
                            throw new Exception("当前托盘不是拼托出库托盘");
                        }
                        //记录托盘上信息给MES
                        data.Add(new RequertBeiliaoInfoModel()
                        {
                            materiel_no = item.SkuNo,
                            materiel_name = item.SkuName,
                            qty = item.Qty,
                            batch = item.LotNo,
                            producttime = item.ProductionTime,
                            expiry = item.ExpirationTime
                        });
                        //库存箱码明细删除
                        var boxInfo = Db.Queryable<DataBoxInfo>().Where(m => m.IsDel == "0" && m.StockDetailId == item.Id).ToList();
                        if (boxInfo.Count == 0)
                        {
                            throw new Exception("托盘上物料箱码信息不存在,请检查!");
                        }
                        foreach (var item2 in boxInfo)
                        {
                            data.Add(new RequertBeiliaoInfoModel()
                            {
                                no = item2.BoxNo,
                                materiel_no = item.SkuNo,
                                materiel_name = item.SkuName,
                                qty = item.Qty,
                                batch = item.LotNo,
                                producttime = item2.ProductionTime.ToString().Substring(1, 8),
                                expiry = item2.ExpirationTime.ToString().Substring(1, 8)
                            });
                        }
                        //库存箱码明细删除
                        Db.Deleteable(boxInfo).ExecuteCommand();
                        //删除库存托盘信息
                        Db.Deleteable(item).ExecuteCommand();
@@ -1420,32 +1427,33 @@
                    Db.Updateable(endLocate).ExecuteCommand();
                }
                if (endLocate!= null && endLocate.AreaNo == "B12")
                {
                    //获取令牌
                    var token = new Token().GetMesToken(mesTokenUrl);
                    Dictionary<string, string> mesDic = new Dictionary<string, string>()
                    {
                        {"Authorization",token }
                    };
                    var mesData = new RequertBeiliaoModel()
                    {
                        morder_no = stockDetail.First().SONo,
                        pallet = stockDetail.First().PalletNo,
                        layer_no = endLocate.LocatNo,
                        items = data
                    };
                    var jsonData = JsonConvert.SerializeObject(mesData);
                    //调用接口
                    var response = HttpHelper.DoPost(mesUrl, jsonData, "备料完成运至缓存区反馈至MES", "MES", mesDic);
                //正式运行程序放开
                //if (endLocate!= null && endLocate.AreaNo == "B12")
                //{
                //    //获取令牌
                //    var token = new Token().GetMesToken(mesTokenUrl);
                //    Dictionary<string, string> mesDic = new Dictionary<string, string>()
                //    {
                //        {"Authorization",token }
                //    };
                //    var mesData = new RequertBeiliaoModel()
                //    {
                //        morder_no = stockDetail.First().SONo,
                //        pallet = stockDetail.First().PalletNo,
                //        layer_no = endLocate.LocatNo,
                //        items = data
                //    };
                //    var jsonData = JsonConvert.SerializeObject(mesData);
                //    //调用接口
                //    var response = HttpHelper.DoPost(mesUrl, jsonData, "备料完成运至缓存区反馈至MES", "MES", mesDic);
                    var obj = JsonConvert.DeserializeObject<MesModel>(response);//解析返回数据
                    if (obj.status != "0")
                    {
                        throw new Exception("备料同步MES失败:" + obj.message);
                    }
                //    var obj = JsonConvert.DeserializeObject<MesModel>(response);//解析返回数据
                //    if (obj.status != "0")
                //    {
                //        throw new Exception("备料同步MES失败:" + obj.message);
                //    }
                }
                //}
                if (userId != 0)
                {
                    //添加操作日志记录