/// <summary> /// 货柜信息 /// </summary> public BoxRpt BoxInfo(int box) { BoxRpt boxRpt = new BoxRpt(); int colcount = JPBoxConfigUtil.GetColcount(m_com); HuoDaoRpt huoDaoRpt = base.GET_HUODAO((byte)box); int i = 0; foreach (HuoDaoInfo huoDaoInfo in huoDaoRpt.HuoDaoInfoList) { i++; RoadRpt roadRpt = new RoadRpt(); roadRpt.Floor = ((i - 1) / colcount) + 1; roadRpt.Num = ((i - 1) % colcount) + 1; roadRpt.IsOK = huoDaoInfo.HuoDaoSt == HuoDaoSt.正常 ? true : false; switch (huoDaoInfo.HuoDaoSt) { case HuoDaoSt.货道不存在: roadRpt.ErrorMsg = "货道不存在"; break; case HuoDaoSt.暂不可用: roadRpt.ErrorMsg = "货道暂不可用"; break; case HuoDaoSt.故障: roadRpt.ErrorMsg = "货道故障"; break; } roadRpt.Remainder = huoDaoInfo.Remainder; boxRpt.RoadCollection.RoadList.Add(roadRpt); } return(boxRpt); }
/// <summary> /// 查询单个货道信息 /// </summary> public RoadRpt QueryRoadRpt(int box, int floor, int num) { RoadRpt roadRpt = new RoadRpt(); if (huoDaoRpt == null) { huoDaoRpt = base.GET_HUODAO((byte)box); } int hd_id = -1; #region 计算货道 hd_id = (byte)((floor - 1) * JPBoxConfigUtil.GetColcount(m_com) + num); #endregion if (hd_id <= 0 || hd_id > huoDaoRpt.HuoDaoInfoList.Count) { roadRpt.IsOK = false; roadRpt.ErrorMsg = "换算物理货道失败"; return(roadRpt); } HuoDaoInfo huoDaoInfo = huoDaoRpt.HuoDaoInfoList[hd_id - 1]; roadRpt.Floor = floor; roadRpt.Num = num; if (huoDaoInfo.HuoDaoSt == HuoDaoSt.正常) { roadRpt.IsOK = true; roadRpt.Remainder = huoDaoInfo.Remainder; } else { roadRpt.IsOK = false; switch (huoDaoInfo.HuoDaoSt) { case HuoDaoSt.故障: roadRpt.ErrorMsg = "货道故障"; break; case HuoDaoSt.货道不存在: roadRpt.ErrorMsg = "货道不存在"; break; case HuoDaoSt.暂不可用: roadRpt.ErrorMsg = "货道暂不可用"; break; } } return(roadRpt); }
/// <summary> /// 出货 /// </summary> /// <param name="box">货柜</param> /// <param name="floor">货道层</param> /// <param name="num">货道列</param> /// <param name="cash">是否现金支付</param> /// <param name="cost">金额(单位:分)</param> /// <param name="check">是否掉货检测</param> public OperateResult Shipment(int box, int floor, int num, bool cash, int cost, bool check) { OperateResult result = new OperateResult(); byte hd_id = 0x00; #region 计算货道 hd_id = (byte)((floor - 1) * JPBoxConfigUtil.GetColcount(m_com) + num); #endregion byte type = cash ? (byte)0x00 : (byte)0x01; VendoutRpt vendoutRpt = base.VENDOUT_IND((byte)box, 2, hd_id, type, cost); if (vendoutRpt.status == 0) { if (cash) { //出货完成扣款 CostRpt costRpt = base.COST_IND(0, cost, (byte)0x00); if (costRpt.value == cost) { result.Success = true; } else { result.Success = false; result.ErrorMsg = "扣款失败"; FileLogger.LogError(string.Format("扣款失败,出货柜号:{0},层:{1},列:{2}", box, floor, num)); } } else { result.Success = true; } } else { result.Success = false; result.ErrorMsg = "出货失败"; FileLogger.LogError(string.Format("出货失败,柜号:{0},层:{1},列:{2}", box, floor, num)); } return(result); }