| | |
| | | //"ConnectionString": "PORT=5432;DATABASE=xxx;HOST=localhost;PASSWORD=xxx;USER ID=xxx", // PostgreSQL 库连接字符串 |
| | | //"ConnectionString": "Server=localhost;Database=xxx;Uid=xxx;Pwd=xxx;SslMode=None;", // MySql 库连接字符串", |
| | | //"ConnectionString": "User Id=xxx; Password=xxx; Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)))", // Oracle 库连接字符串 |
| | | "ConnectionString": "Server=10.18.99.10;Database=WCSnet6;User Id=sa;Password=sql2024;", // SqlServer 库连接字符串 |
| | | "ConnectionString": "Server=10.18.99.10;Database=WCSnet6;User Id=sa;Password=sql2024;MultipleActiveResultSets=True;", // SqlServer 库连接字符串 |
| | | //"ConnectionString": "Server=192.168.62.200;Database=WCSnet6;User Id=sa;Password=sql2019;", // SqlServer 库连接字符串 |
| | | |
| | | |
| | |
| | | /// </summary> |
| | | public decimal Qty { get; set; } |
| | | /// <summary> |
| | | /// 箱数量 |
| | | /// </summary> |
| | | public decimal xQty { get; set; } |
| | | /// <summary> |
| | | /// 满箱数量 |
| | | /// </summary> |
| | | public decimal FullQty { get; set; } |
| | | /// <summary> |
| | | /// 托盘类型 0物料托 1空托盘托 |
| | | /// </summary> |
| | | public string Type { get; set; } |
| | |
| | | /// 物料编码 |
| | | /// </summary> |
| | | public string SkuNo { get; set; } |
| | | /// <summary> |
| | | /// 物料名称 |
| | | /// </summary> |
| | | public string SkuName { get; set; } |
| | | /// <summary> |
| | | /// 批次号 |
| | | /// </summary> |
| | |
| | | /// 供货批次 |
| | | /// </summary> |
| | | public string SupplierLot { get; set; } |
| | | /// <summary> |
| | | /// 生产日期 |
| | | /// </summary> |
| | | public DateTime? ProductionTime { get; set; } |
| | | /// <summary> |
| | | /// 过期时间 |
| | | /// </summary> |
| | | public DateTime? ExpirationTime { get; set; } |
| | | /// <summary> |
| | | /// 检验标记 |
| | | /// </summary> |
| | | public string InspectMark { get; set; } |
| | | /// <summary> |
| | | /// 零箱标记 |
| | | /// </summary> |
| | | public string BitBoxMark { get; set; } |
| | | /// <summary> |
| | | /// 质检状态 |
| | | /// </summary> |
| | | public string InspectStatus { get; set; } |
| | | /// <summary> |
| | | /// 物料规格 |
| | | /// </summary> |
| | | public string Standard { get; set; } |
| | | /// <summary> |
| | | /// 包装规格 |
| | | /// </summary> |
| | | public string PackageStandard { get; set; } |
| | | /// <summary> |
| | | /// 储存期至 |
| | | /// </summary> |
| | | public DateTime? StoreTime { get; set; } |
| | | /// <summary> |
| | | /// 第几件 |
| | | /// </summary> |
| | | public int? QtyOrd { get; set; } |
| | | /// <summary> |
| | | /// 总件数 |
| | | /// </summary> |
| | | public int? QtyCount { get; set; } |
| | | public List<BindBox> Detail { get; set; } |
| | | public List<WcsBoxInfo> Detail { get; set; } |
| | | } |
| | | //码垛箱码明细信息 |
| | | public class BoxPalletBindDetailVm |
| | |
| | | /// 任务号 |
| | | /// </summary> |
| | | public string TaskNo { get; set; } |
| | | } |
| | | |
| | | //自动码垛组盘信息回传 |
| | | public class BindBox |
| | | { |
| | | /// <summary> |
| | | /// 箱码 |
| | | /// </summary> |
| | | public string? BoxNo { get; set; } |
| | | /// <summary> |
| | | /// 盒码 |
| | | /// </summary> |
| | | public string? BoxNo2 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 支码 |
| | | /// </summary> |
| | | public string? BoxNo3{ get; set; } |
| | | } |
| | |
| | | |
| | | private static int fendao = 1; |
| | | |
| | | |
| | | public static void OnChangeEvent(object sender, EventArgs e) |
| | | { |
| | | try |
| | |
| | | private static void ConveyorLine(WcsDeviceDto modDevice) |
| | | { |
| | | var plcConn = modDevice.PLCUtil; |
| | | |
| | | // 获取楼层数ceshi |
| | | var louCeng = PLCCommon.GetRoadwayByStationNew(modDevice.StationNum); |
| | | if (louCeng == "") |
| | |
| | | { |
| | | lock (OLock) |
| | | { |
| | | Thread.Sleep(2000); |
| | | // 根据工位号,获取托盘号 |
| | | var checkTaskMedel = _db.Queryable<WcsCheckTask>().First(m => m.Port == modDevice.StationNum && m.IsDelete == false); |
| | | // 根据工位号获取 托盘线该工位号的配置信息 |
| | |
| | | } |
| | | else |
| | | { |
| | | if (string.IsNullOrEmpty(palletNo)) |
| | | { |
| | | break; |
| | | } |
| | | // 根据托盘号,将组托信息插入boxinfolog表 并删除boxinfo表数据 |
| | | var boxInfoList = _db.Queryable<WcsBoxInfo>().Where(w => w.IsDelete == false && w.PalletNo == palletNo).ToList(); |
| | | if (boxInfoList.Count <= 0) |
| | |
| | | var retVal = plcConn.SetPlcDBValue(posModel.PosType, numModel.DbNumber, posModel.PlcPos, "234"); |
| | | if (retVal.IsSucceed) |
| | | { |
| | | //更新任务表数量信息 |
| | | checkTaskMedel.Qty = 0; |
| | | _db.Updateable(checkTaskMedel).ExecuteCommand(); |
| | | // 写入组托回复流程字 |
| | | retVal = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "50"); |
| | | } |
| | | break; |
| | | } |
| | | #region |
| | | //判断托盘上的箱码是否已组盘 |
| | | foreach (var item in boxInfoList) |
| | | { |
| | | var groupBoxno = _db.Queryable<WcsBoxInfoLog>().Where(w => w.BoxNo == item.BoxNo).ToList(); |
| | | if (groupBoxno.Count>0) |
| | | { |
| | | Log.Error(string.Format("申请巷道失败,码垛工位{0},箱码信息不存在", modDevice.StationNum)); |
| | | // 写入交互工位目标地址 |
| | | var retVal = plcConn.SetPlcDBValue(posModel.PosType, numModel.DbNumber, posModel.PlcPos, "234"); |
| | | if (retVal.IsSucceed) |
| | | { |
| | | // 写入组托回复流程字 |
| | | retVal = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "50"); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //var groupBoxno = _db.Queryable<WcsBoxInfoLog>().Where(w => w.BoxNo == item.BoxNo).ToList(); |
| | | //if (groupBoxno.Count>0) |
| | | //{ |
| | | // Log.Error(string.Format("申请巷道失败,码垛工位{0},箱码信息不存在", modDevice.StationNum)); |
| | | // // 写入交互工位目标地址 |
| | | // var retVal = plcConn.SetPlcDBValue(posModel.PosType, numModel.DbNumber, posModel.PlcPos, "234"); |
| | | // if (retVal.IsSucceed) |
| | | // { |
| | | // // 写入组托回复流程字 |
| | | // retVal = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "50"); |
| | | // } |
| | | // break; |
| | | //} |
| | | #endregion |
| | | // 组托成功后将信息存到log表 |
| | | string sqlStr = $"insert into WCSBoxInfoLog select * from WCSBoxInfo where IsDelete=0 and PalletNo='{palletNo}'"; |
| | | int insertCount = _db.Ado.ExecuteCommand(sqlStr); |
| | |
| | | string sqlStr2 = $"delete from WCSBoxInfo where IsDelete=0 and PalletNo='{palletNo}'"; |
| | | _db.Ado.ExecuteCommand(sqlStr2); |
| | | } |
| | | //组盘成功后清空分拣表当前托盘上物料数量 |
| | | checkTaskMedel.Qty = 0; |
| | | _db.Updateable(checkTaskMedel).ExecuteCommand(); |
| | | |
| | | // 向WMS申请巷道 |
| | | var http = new HttpService(); |
| | | string TaskNo = "", EndLocate = ""; |
| | |
| | | if (strMsg.Contains("-1")) |
| | | { |
| | | Log.Error(string.Format("申请巷道失败,码垛工位{0};原因{1}", modDevice.StationNum, strMsg)); |
| | | // 写入交互工位目标地址 |
| | | var retVal = plcConn.SetPlcDBValue(posModel.PosType, numModel.DbNumber, posModel.PlcPos, "234"); |
| | | if (retVal.IsSucceed) |
| | | { |
| | | //更新任务表数量信息 |
| | | checkTaskMedel.Qty = 0; |
| | | _db.Updateable(checkTaskMedel).ExecuteCommand(); |
| | | // 写入组托回复流程字 |
| | | retVal = plcConn.SetPlcDBValue(modDevice.PosType, modDevice.DbNumber, modDevice.WcsPos, "50"); |
| | | } |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | //组盘成功后清空分拣表当前托盘上物料数量 |
| | | checkTaskMedel.Qty = 0; |
| | | _db.Updateable(checkTaskMedel).ExecuteCommand(); |
| | | //判断是否结批中 |
| | | var (res, jiepi) = plcConn.GetPlcDBValue(checkTaskMedel.PosType, modDevice.DbNumber, checkTaskMedel.PosLot); |
| | | if (jiepi == 2)//结批中 |
| | |
| | | var task = _db.Queryable<WcsTask>().First(m => m.IsDelete == false && (m.Status == TaskStatusEnum.Wait || m.Status == TaskStatusEnum.Doing) && m.TaskType == TaskTypeEnum.In && m.PalletNo == palletNo); |
| | | if (task == null) |
| | | { |
| | | var box = new BindBox(); |
| | | List<BindBox> bindBox = new List<BindBox>(); |
| | | foreach (var item in detail) |
| | | { |
| | | box.BoxNo = item.BoxNo; |
| | | box.BoxNo2 = item.BoxNo2; |
| | | box.BoxNo3 = item.BoxNo3; |
| | | bindBox.Add(box); |
| | | } |
| | | var model = new BoxPalletBindVm() |
| | | { |
| | | OrderCode = "",//暂无上游系统编号 |
| | |
| | | AsnDetailNo = 0,//暂无入库单明细编号,WMS根据物料批次查找 |
| | | PalletNo = palletNo, |
| | | Qty = qty, |
| | | xQty = (decimal)detail[0].Qty, |
| | | FullQty = (decimal)detail[0].FullQty, |
| | | Type = type, |
| | | SkuNo = skuNo, |
| | | SkuName = detail[0].SkuName, |
| | | LotNo = lotNo, |
| | | LotText = lotText, |
| | | SupplierLot = supplierLot, |
| | | ProductionTime = detail[0].ProductionTime, |
| | | ExpirationTime = detail[0].ExpirationTime, |
| | | InspectMark = detail[0].InsPectMark, |
| | | BitBoxMark = detail[0].BitBoxMark, |
| | | InspectStatus = "", |
| | | Standard = detail[0].Standard, |
| | | PackageStandard = detail[0].PackageStandard, |
| | | StoreTime = detail[0].StoreTime, |
| | | QtyOrd = detail[0].QtyOrd, |
| | | QtyCount = detail[0].QtyCount, |
| | | Detail = bindBox |
| | | Detail = detail |
| | | }; |
| | | string url = Urls.WMSAddress + ":" + Urls.WMSPort; |
| | | var result = (url + "/api/DownAPi/BindRequestRoadWay").SetBody(model, "application/json", Encoding.UTF8).PostAsAsync<ResponseTasks>().Result; |