public static bool HasPermission(IpMaster ipMaster, User user) { return HasPermission(user.Permissions, ipMaster.OrderType, ipMaster.IsCheckPartyFromAuthority, ipMaster.IsCheckPartyToAuthority, ipMaster.PartyFrom, ipMaster.PartyTo); }
protected override void ScanBarCode() { base.ScanBarCode(); if (this.orderMasters.Count == 0 && this.ipMaster == null) { if (base.op == CodeMaster.BarCodeType.ORD.ToString()) { this.orderMasters = new List<OrderMaster>(); var orderMaster = smartDeviceService.GetOrder(base.barCode, true); if (orderMaster.PauseStatus == PauseStatus.Paused) { throw new BusinessException("订单已暂停"); } this.CheckAndMerge(orderMaster); } else if (base.op == CodeMaster.BarCodeType.ASN.ToString() || base.op == CodeMaster.BarCodeType.W.ToString() || base.op == CodeMaster.BarCodeType.SP.ToString()) { var ipMaster = new IpMaster(); if (base.op == CodeMaster.BarCodeType.ASN.ToString()) { ipMaster = smartDeviceService.GetIp(base.barCode, true); } else { ipMaster = smartDeviceService.GetIpByWmsIpNo(base.barCode, true); } //if (!ipMaster.IsReceiveScanHu && ipMaster.Type != IpType.KIT) //{ // throw new BusinessException("数量收货,不需要扫描条码。"); //} if (ipMaster.IpDetails == null || ipMaster.IpDetails.Length == 0) { throw new BusinessException("没有送货单明细。"); } if (!Utility.HasPermission(ipMaster, base.user)) { throw new BusinessException("没有送货单的权限。"); } var ipDetailList = ipMaster.IpDetails.Where(o => o.RemainReceivedQty > 0).ToList(); if (ipDetailList.Count == 0) { throw new BusinessException("送货单{0}已完成收货。", ipMaster.IpNo); } ipDetailList = new List<IpDetail>(); ipDetailList = ipMaster.IpDetails.Where(o => !string.IsNullOrEmpty(o.GapReceiptNo)).ToList(); if (ipDetailList.Count > 0) { throw new BusinessException("送货单{0}已完成收货。", ipMaster.IpNo); } this.ipMaster = ipMaster; this.gvListDataBind(); } else { throw new BusinessException("请扫描订单或送货单。"); } } else { if (base.op == CodeMaster.BarCodeType.ORD.ToString()) { if (this.ipMaster.Type == IpType.KIT) { throw new BusinessException("Kit单不可以合并发货"); } var orderMaster = smartDeviceService.GetOrder(base.barCode, true); if (orderMaster.PauseStatus == PauseStatus.Paused) { throw new BusinessException("订单已暂停"); } this.CheckAndMerge(orderMaster); } else if (base.op == CodeMaster.BarCodeType.HU.ToString()) { if ((this.orderMasters == null || this.orderMasters.Count() == 0) && (this.ipMaster == null)) { throw new BusinessException("请先扫描订单"); } Hu hu = smartDeviceService.GetHu(barCode); if (this.ipMaster == null) { this.MatchOrderMaster(hu); } else { this.MatchIpMaster(hu); } this.isScanOne = true; } else if (base.op == CodeMaster.BarCodeType.B.ToString()) { base.barCode = base.barCode.Substring(2, base.barCode.Length - 2); Bin bin = smartDeviceService.GetBin(base.barCode); this.binCode = bin.Code; this.lblMessage.Text = "当前库格:" + bin.Code; //检查权限 if (!Utility.HasPermission(user.Permissions, null, false, true, null, bin.Region)) { throw new BusinessException("没有此移库路线的权限"); } } else if (base.op == CodeMaster.BarCodeType.DATE.ToString()) { base.barCode = base.barCode.Substring(2, base.barCode.Length - 2); this.effDate = base.smartDeviceService.GetEffDate(base.barCode); this.lblMessage.Text = "生效时间:" + this.effDate.Value.ToString("yyyy-MM-dd HH:mm"); this.tbBarCode.Text = string.Empty; //this.tbBarCode.Focus(); } else { throw new BusinessException("条码格式不合法"); } } }
protected override void ScanBarCode() { base.ScanBarCode(); if (this.orderMasters.Count == 0 && this.ipMaster == null) { if (base.op == CodeMaster.BarCodeType.ORD.ToString()) { this.orderMasters = new List<OrderMaster>(); var orderMaster = smartDeviceService.GetOrder(base.barCode, true); if (orderMaster.IsPause) { throw new BusinessException("订单已暂停"); } this.CheckAndMerge(orderMaster); this.lblMessage.Text = "请继续扫描订单或者物料条码"; } else if (base.op == CodeMaster.BarCodeType.ASN.ToString() || base.op == CodeMaster.BarCodeType.W.ToString() || base.op == CodeMaster.BarCodeType.SP.ToString()) { var ipMaster = new IpMaster(); ipMaster = smartDeviceService.GetIp(base.barCode, true); if (ipMaster.IpDetails == null || ipMaster.IpDetails.Length == 0) { throw new BusinessException("没有送货单明细"); } if (!Utility.HasPermission(ipMaster, base.user)) { throw new BusinessException("没有送货单的权限。"); } VerifyPermission(ipMaster.PartyTo); if (ipMaster.IsReceiveScanHu == false && ipMaster.Type != IpType.KIT) { throw new BusinessException("送货单{0}不需要扫描条码。", ipMaster.IpNo); //DialogResult dr = MessageBox.Show("送货单收货不需要扫描条码,是否继续?", "无需扫描", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); //if (dr == DialogResult.No) //{ // this.isMark = true; // return; //} } var ipDetailList = ipMaster.IpDetails.Where(o => o.RemainReceivedQty > 0).ToList(); if (ipDetailList.Count == 0) { throw new BusinessException("送货单{0}已完成收货。", ipMaster.IpNo); } ipDetailList = new List<IpDetail>(); ipDetailList = ipMaster.IpDetails.Where(o => !string.IsNullOrEmpty(o.GapReceiptNo)).ToList(); if (ipDetailList.Count > 0) { throw new BusinessException("送货单{0}已完成收货。", ipMaster.IpNo); } this.lblMessage.Text = "请扫描物料条码。"; this.ipMaster = ipMaster; this.tbBarCode.Focus(); this.gvListDataBind(); } else { throw new BusinessException("请扫描订单或送货单。"); } } else { if (base.op == CodeMaster.BarCodeType.ORD.ToString() && this.isContinueScanOrder == true) { var orderMaster = smartDeviceService.GetOrder(base.barCode, true); if (orderMaster.IsPause) { throw new BusinessException("订单已暂停。"); } this.CheckAndMerge(orderMaster); } else if (base.op == CodeMaster.BarCodeType.HU.ToString()) { if ((this.orderMasters == null || this.orderMasters.Count() == 0) && (this.ipMaster == null)) { throw new BusinessException("请先扫描订单。"); } Hu hu = smartDeviceService.GetHu(barCode); if (this.ipMaster == null) { this.MatchOrderMaster(hu); } else { this.MatchIpMaster(hu); } this.isContinueScanOrder = false; } else if (base.op == CodeMaster.BarCodeType.B.ToString()) { base.barCode = base.barCode.Substring(2, base.barCode.Length - 2); Bin bin = smartDeviceService.GetBin(base.barCode); this.binCode = bin.Code; this.lblMessage.Text = "当前库格:" + bin.Code; //检查权限 if (!Utility.HasPermission(user.Permissions, null, false, true, null, bin.Region)) { throw new BusinessException("没有此库格的权限"); } } else if (base.op == CodeMaster.BarCodeType.DATE.ToString()) { base.barCode = base.barCode.Substring(2, base.barCode.Length - 2); this.effDate = base.smartDeviceService.GetEffDate(base.barCode); this.lblMessage.Text = "生效时间:" + this.effDate.Value.ToString("yyyy-MM-dd HH:mm"); this.tbBarCode.Text = string.Empty; this.tbBarCode.Focus(); } else { throw new BusinessException("条码格式不合法"); } } }
protected override void Reset() { //this.ipDetailProcess = new List<IpDetailInput>(); this.orderMasters = new List<OrderMaster>(); this.ipMaster = null; base.Reset(); this.lblMessage.Text = "请扫描订单或送货单。"; this.effDate = null; }
protected override void Reset() { //this.ipDetailProcess = new List<IpDetailInput>(); this.flowMaster = null; this.orderMasters = new List<OrderMaster>(); this.ipMaster = null; this.isContinueScanOrder = true; base.Reset(); this.effDate = null; }