Пример #1
0
 private void Reset()
 {
     lblMessage.Text = "请扫描Van号";
     lblFlowInfo.Text = string.Empty;
     lblVANInfo.Text = string.Empty;
     this.orderMaster = null;
     this.traceCode = string.Empty;
     this.prodLine = string.Empty;
     this.barCode = string.Empty;
 }
Пример #2
0
 private void Reset()
 {
     lblMessage.Text = "请扫描驾驶室生产单";
     lblItemInfo.Text = string.Empty;
     lblRefItemInfo.Text = string.Empty;
     lblBarCodeInfo.Text = string.Empty;
     lblFlowInfo.Text = string.Empty;
     lblWindowTimeInfo.Text = string.Empty;
     lblStartTimeInfo.Text = string.Empty;
     lblVANInfo.Text = string.Empty;
     lblWoInfo.Text = string.Empty;
     lblSeqInfo.Text = string.Empty;
     lblItemDescInfo.Text = string.Empty;
     this.orderMaster = null;
 }
Пример #3
0
        private void ScanBarCode()
        {
            this.barCode = this.tbBarCode.Text.Trim();
            this.lblMessage.Text = string.Empty;
            this.tbBarCode.Text = string.Empty;

            if (this.barCode.Length < 3)
            {
                throw new BusinessException("条码格式不合法");
            }
            this.op = Utility.GetBarCodeType(this.user.BarCodeTypes, this.barCode);

            if (this.orderMaster == null && this.flowMaster == null)
            {
                if (this.op == CodeMaster.BarCodeType.ORD.ToString())
                {
                    if (this.orderMaster == null)
                    {
                        this.Reset();
                        this.lblSeq.Text = "序号:";
                        this.lblFlow.Text = "产线:";
                        this.lblWo.Text = "工单:";
                        var orderMaster = this.smartDeviceService.GetOrder(this.barCode, true);
                        if (orderMaster.PauseStatus == PauseStatus.Paused)
                        {
                            throw new BusinessException("订单已暂停");
                        }

                        //检查订单状态
                        if (orderMaster.Status != OrderStatus.InProcess)
                        {
                            throw new BusinessException("不是InProcess状态不能操作");
                        }

                        if (orderMaster.Type == OrderType.Production)
                        {
                            if (orderMaster.OrderDetails.Length != 1)
                            {
                                throw new BusinessException("只能对一料一单的生产单操作");
                            }

                            OrderDetail orderDetail = orderMaster.OrderDetails[0];

                            this.lblSeqInfo.Text = orderMaster.Sequence.ToString();
                            this.lblFlowInfo.Text = orderMaster.Flow;
                            this.lblWoInfo.Text = orderMaster.OrderNo;
                            this.lblVANInfo.Text = orderMaster.TraceCode;
                            this.lblFgInfo.Text = orderDetail.Item;
                            this.lblFgDescInfo.Text = orderDetail.ItemDescription;
                            this.tabPanel.SelectedIndex = 0;
                        }
                        else
                        {
                            throw new BusinessException("订单类型不正确:{0}", orderMaster.Type.ToString());
                        }

                        #region 界面控制
                        this.lblSeq.Visible = true;
                        this.lblFlow.Visible = true;
                        this.lblWo.Visible = true;
                        this.lblVAN.Visible = true;
                        this.lblFg.Visible = true;
                        this.lblFgDescription.Visible = true;
                        #endregion
                        this.orderMaster = orderMaster;
                    }
                }
                else if (this.op == CodeMaster.BarCodeType.Z.ToString() || this.op == CodeMaster.BarCodeType.F.ToString())
                {
                    this.Reset();
                    this.barCode = this.barCode.Substring(2, this.barCode.Length - 2);
                    if (this.op == CodeMaster.BarCodeType.F.ToString())
                    {
                        this.flowMaster = smartDeviceService.GetFlowMaster(this.barCode, false);
                    }
                    else
                    {
                        //this.flowMaster = smartDeviceService.GetFlowMasterByFacility(this.barCode, false);
                        if (flowMaster != null)
                        {
                            this.facilityCode = this.barCode;
                        }
                    }

                    //检查订单类型
                    if (this.flowMaster.Type != OrderType.Production)
                    {
                        throw new BusinessException("不是生产线设备不能退料。");
                    }

                    //是否有效
                    if (!this.flowMaster.IsActive)
                    {
                        throw new BusinessException("此生产线无效。");
                    }

                    //检查权限
                    //if (!Utility.HasPermission(this.flowMaster, this.user))
                    //{
                    //    throw new BusinessException("没有此生产线的权限");
                    //}
                    this.lblMessage.Text = this.flowMaster.Description;
                    //this.gvListDataBind();

                    this.lblSeq.Text = "产线:";
                    this.lblSeq.Visible = true;
                    this.lblSeqInfo.Text = this.flowMaster.Code;
                    this.lblFlow.Text = "描述:";
                    this.lblFlow.Visible = true;
                    this.lblFlowInfo.Text = this.flowMaster.Description;
                    this.lblWo.Text = "区域:";
                    this.lblWo.Visible = true;
                    this.lblWoInfo.Text = this.flowMaster.PartyFrom;

                    this.lblVANInfo.Text = string.Empty;

                    this.lblFgInfo.Text = string.Empty;

                    this.lblFgDescInfo.Text = string.Empty;
                    this.tabPanel.SelectedIndex = 0;
                }
            }
            else
            {
                if (this.barCode.Length == 17 && Utility.IsValidateLotNo(this.barCode.Substring(9, 4)) == true)
                {
                    this.op = CodeMaster.BarCodeType.HU.ToString();
                }
                if (this.op == CodeMaster.BarCodeType.HU.ToString())
                {
                    if (this.hus == null)
                    {
                        this.hus = new List<Hu>();
                    }
                    if (this.flowMaster == null && this.orderMaster == null)
                    {
                        throw new BusinessException("请先扫描生产单或生产线");
                    }

                    Hu hu = smartDeviceService.GetHu(this.barCode);
                    if (hu == null)
                    {
                        throw new BusinessException("条码不存在");
                    }
                    hu.CurrentQty = hu.Qty;
                    var matchHu = this.hus.Where(h => h.HuId.Equals(hu.HuId, StringComparison.OrdinalIgnoreCase));
                    if (matchHu != null && matchHu.Count() > 0)
                    {
                        throw new BusinessException("条码重复扫描!");
                    }
                    if (hu.Status == HuStatus.Location)
                    {
                        throw new BusinessException("条码在库存中,不能退料");
                    }

                    if (this.orderMaster != null)
                    {
                        this.hus.Insert(0, hu);
                        //this.lblVANInfo1.Text = this.orderMaster.TraceCode;
                        this.gvHuListDataBind();

                    }
                    else if (this.flowMaster != null)
                    {
                        this.hus.Insert(0, hu);
                        this.gvHuListDataBind();
                    }
                    else
                    {
                        this.Reset();
                        throw new BusinessException("请先扫描生产单或生产线");
                    }

                    this.tabPanel.SelectedIndex = 1;
                }


                else if (this.op == CodeMaster.BarCodeType.DATE.ToString())
                {
                    this.barCode = this.barCode.Substring(2, this.barCode.Length - 2);
                    this.effDate = this.smartDeviceService.GetEffDate(this.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("条码格式不合法。");
                }
            }
            #region 旧代码
            //if (this.op == CodeMaster.BarCodeType.ORD.ToString())
            //{
            //    if (this.orderMaster == null)
            //    {
            //        this.Reset();
            //        this.lblSeq.Text = "序号:";
            //        this.lblFlow.Text = "产线:";
            //        this.lblWo.Text = "工单:";
            //        var orderMaster = this.smartDeviceService.GetOrder(this.barCode, true);
            //        if (orderMaster.IsPause)
            //        {
            //            throw new BusinessException("订单已暂停");
            //        }

            //        //检查订单状态
            //        if (orderMaster.Status != OrderStatus.InProcess)
            //        {
            //            throw new BusinessException("不是InProcess状态不能操作");
            //        }

            //        if (orderMaster.Type == OrderType.Production)
            //        {
            //            if (orderMaster.OrderDetails.Length != 1)
            //            {
            //                throw new BusinessException("只能对一料一单的生产单操作");
            //            }

            //            OrderDetail orderDetail = orderMaster.OrderDetails[0];

            //            this.lblSeqInfo.Text = orderMaster.Sequence.ToString();
            //            this.lblFlowInfo.Text = orderMaster.Flow;
            //            this.lblWoInfo.Text = orderMaster.OrderNo;
            //            this.lblVANInfo.Text = orderMaster.TraceCode;
            //            this.lblFgInfo.Text = orderDetail.Item;
            //            this.lblFgDescInfo.Text = orderDetail.ItemDescription;
            //            this.tabPanel.SelectedIndex = 0;
            //        }
            //        else
            //        {
            //            throw new BusinessException("订单类型不正确:{0}", orderMaster.Type.ToString());
            //        }

            //        #region 界面控制
            //        this.lblSeq.Visible = true;
            //        this.lblFlow.Visible = true;
            //        this.lblWo.Visible = true;
            //        this.lblVAN.Visible = true;
            //        this.lblFg.Visible = true;
            //        this.lblFgDescription.Visible = true;
            //        #endregion
            //        this.orderMaster = orderMaster;
            //    }
            //}

            //else if (this.op == CodeMaster.BarCodeType.HU.ToString())
            //{
            //    if (this.hus == null)
            //    {
            //        this.hus = new List<Hu>();
            //    }
            //    if (this.flowMaster == null && this.orderMaster == null)
            //    {
            //        throw new BusinessException("请先扫描生产单或生产线");
            //    }

            //    Hu hu = smartDeviceService.GetHu(this.barCode);
            //    if (hu == null)
            //    {
            //        throw new BusinessException("条码不存在");
            //    }
            //    hu.CurrentQty = hu.Qty;
            //    var matchHu = this.hus.Where(h => h.HuId.Equals(hu.HuId, StringComparison.OrdinalIgnoreCase));
            //    if (matchHu != null && matchHu.Count() > 0)
            //    {
            //        throw new BusinessException("条码重复扫描!");
            //    }
            //    if (hu.Status == HuStatus.Location)
            //    {
            //        throw new BusinessException("条码在库存中,不能退料");
            //    }

            //    if (this.orderMaster != null)
            //    {
            //        this.hus.Insert(0, hu);
            //        //this.lblVANInfo1.Text = this.orderMaster.TraceCode;
            //        this.gvHuListDataBind();

            //    }
            //    else if (this.flowMaster != null)
            //    {
            //        this.hus.Insert(0, hu);
            //        this.gvHuListDataBind();
            //    }
            //    else
            //    {
            //        this.Reset();
            //        throw new BusinessException("请先扫描生产单或生产线");
            //    }

            //    this.tabPanel.SelectedIndex = 1;
            //}
            

            //else if (this.op == CodeMaster.BarCodeType.DATE.ToString())
            //{
            //    this.barCode = this.barCode.Substring(2, this.barCode.Length - 2);
            //    this.effDate = this.smartDeviceService.GetEffDate(this.barCode);

            //    this.lblMessage.Text = "生效时间:" + this.effDate.Value.ToString("yyyy-MM-dd HH:mm");
            //    this.tbBarCode.Text = string.Empty;
            //    //this.tbBarCode.Focus();
            //}
            //else if (this.op == CodeMaster.BarCodeType.Z.ToString() || this.op == CodeMaster.BarCodeType.F.ToString())
            //{
            //    this.Reset();
            //    this.barCode = this.barCode.Substring(2, this.barCode.Length - 2);
            //    if (this.op == CodeMaster.BarCodeType.F.ToString())
            //    {
            //        this.flowMaster = smartDeviceService.GetFlowMaster(this.barCode, false);
            //    }
            //    else
            //    {
            //        this.flowMaster = smartDeviceService.GetFlowMasterByFacility(this.barCode, false);
            //        if (flowMaster != null)
            //        {
            //            this.facilityCode = this.barCode;
            //        }
            //    }

            //    //检查订单类型
            //    if (this.flowMaster.Type != OrderType.Production)
            //    {
            //        throw new BusinessException("不是生产线设备不能退料。");
            //    }

            //    //是否有效
            //    if (!this.flowMaster.IsActive)
            //    {
            //        throw new BusinessException("此生产线无效。");
            //    }

            //    //检查权限
            //    //if (!Utility.HasPermission(this.flowMaster, this.user))
            //    //{
            //    //    throw new BusinessException("没有此生产线的权限");
            //    //}
            //    this.lblMessage.Text = this.flowMaster.Description;
            //    //this.gvListDataBind();

            //    this.lblSeq.Text = "产线:";
            //    this.lblSeq.Visible = true;
            //    this.lblSeqInfo.Text = this.flowMaster.Code;
            //    this.lblFlow.Text = "描述:";
            //    this.lblFlow.Visible = true;
            //    this.lblFlowInfo.Text = this.flowMaster.Description;
            //    this.lblWo.Text = "区域:";
            //    this.lblWo.Visible = true;
            //    this.lblWoInfo.Text = this.flowMaster.PartyFrom;

            //    this.lblVANInfo.Text = string.Empty;

            //    this.lblFgInfo.Text = string.Empty;

            //    this.lblFgDescInfo.Text = string.Empty;
            //    this.tabPanel.SelectedIndex = 0;
            //}
            //else
            //{
            //    throw new BusinessException("条码格式不合法1");
            //}
            #endregion
        }
Пример #4
0
 public static bool HasPermission(OrderMaster orderMaster, User user)
 {
     return HasPermission(user.Permissions, orderMaster.Type, orderMaster.IsCheckPartyFromAuthority, orderMaster.IsCheckPartyToAuthority, orderMaster.PartyFrom, orderMaster.PartyTo); ;
 }
Пример #5
0
        private void MergeOrderMaster(OrderMaster orderMaster)
        {

            //if (orderMaster.OrderStrategy == FlowStrategy.KIT)
            //{
            //    if (this.orderMasters != null && this.orderMasters.Count > 0)
            //    {
            //        throw new BusinessException("KIT单不能合并发货。");
            //    }
            //}

            if (this.orderMasters == null)
            {
                this.orderMasters = new List<OrderMaster>();
            }



            if (orderMasters.Count(o => o.OrderNo == orderMaster.OrderNo) > 0)
            {
                //订单重复扫描检查
                throw new BusinessException("重复扫描订单。");
            }
            #region 订单类型
            var orderType = orderMasters.Where(o => o.Type != orderMaster.Type);
            if (orderType.Count() > 0)
            {
                throw new BusinessException("订单类型不同不能合并发货。");
            }
            #endregion

            #region 订单质量类型
            var qualityType = orderMasters.Where(o => o.QualityType != orderMaster.QualityType);
            if (qualityType.Count() > 0)
            {
                throw new BusinessException("订单质量状态不同不能合并发货。");
            }
            #endregion

            #region PartyFrom
            var partyFrom = orderMasters.Where(o => o.PartyFrom != orderMaster.PartyFrom);
            if (partyFrom.Count() > 0)
            {
                throw new BusinessException("来源组织不同不能合并发货。");
            }
            #endregion

            #region PartyTo
            var partyTo = orderMasters.Where(o => o.PartyTo != orderMaster.PartyTo);
            if (partyTo.Count() > 0)
            {
                throw new BusinessException("目的组织不同不能合并发货。");
            }
            #endregion

            #region ShipFrom
            var shipFrom = orderMasters.Where(o => o.ShipFrom != orderMaster.ShipFrom);
            if (shipFrom.Count() > 0)
            {
                throw new BusinessException("发货地址不同不能合并发货。");
            }
            #endregion

            #region ShipTo
            var shipTo = orderMasters.Where(o => o.ShipTo != orderMaster.ShipTo);
            if (shipTo.Count() > 0)
            {
                throw new BusinessException("收货地址不同不能合并发货。");
            }
            #endregion

            #region Dock
            var dock = orderMasters.Where(o => o.Dock != orderMaster.Dock);
            if (dock.Count() > 0)
            {
                throw new BusinessException("道口不同不能合并发货。");
            }
            #endregion

            #region IsAutoReceive
            var isAutoReceive = orderMasters.Where(o => o.IsAutoReceive != orderMaster.IsAutoReceive);
            if (isAutoReceive.Count() > 0)
            {
                throw new BusinessException("自动收货选项不同不能合并发货。");
            }
            #endregion

            #region IsShipScanHu
            var isShipScanHu = orderMasters.Where(o => o.IsShipScanHu != orderMaster.IsShipScanHu);
            if (isShipScanHu.Count() > 0)
            {
                throw new BusinessException("发货扫描条码选项不同不能合并发货。");
            }
            #endregion

            #region IsRecScanHu
            var isRecScanHu = orderMasters.Where(o => o.IsReceiveScanHu != orderMaster.IsReceiveScanHu);
            if (isRecScanHu.Count() > 0)
            {
                throw new BusinessException("收货扫描条码选项不同不能合并发货。");
            }
            #endregion

            #region IsRecExceed
            var isRecExceed = orderMasters.Where(o => o.IsReceiveExceed != orderMaster.IsReceiveExceed);
            if (isRecExceed.Count() > 0)
            {
                throw new BusinessException("允许超收选项不同不能合并发货。");
            }
            #endregion

            #region IsRecFulfillUC
            var isRecFulfillUC = orderMasters.Where(o => o.IsReceiveFulfillUC != orderMaster.IsReceiveFulfillUC);
            if (isRecFulfillUC.Count() > 0)
            {
                throw new BusinessException("收货满足包装选项不同不能合并发货。");
            }
            #endregion

            #region IsRecFifo
            var isRecFifo = orderMasters.Where(o => o.IsReceiveFifo != orderMaster.IsReceiveFifo);
            if (isRecFifo.Count() > 0)
            {
                throw new BusinessException("收货先进先出选项不同不能合并发货。");
            }
            #endregion

            #region IsAsnAuotClose
            var isAsnAuotClose = orderMasters.Where(o => o.IsAsnAutoClose != orderMaster.IsAsnAutoClose);
            if (isAsnAuotClose.Count() > 0)
            {
                throw new BusinessException("送货单自动关闭选项不同不能合并发货。");
            }
            #endregion

            #region IsAsnUniqueRec
            var isAsnUniqueRec = orderMasters.Where(o => o.IsAsnUniqueReceive != orderMaster.IsAsnUniqueReceive);
            if (isAsnUniqueRec.Count() > 0)
            {
                throw new BusinessException("送货单一次性收货选项不同不能合并发货。");
            }
            #endregion

            #region IsRecCreateHu
            var createHuOption = from om in orderMasters
                                 where om.CreateHuOption == CreateHuOption.Receive
                                 select om.CreateHuOption;
            if (createHuOption != null && createHuOption.Count() > 0 && createHuOption.Count() != orderMasters.Count())
            {
                throw new BusinessException("收货创建条码选项不同不能合并发货。");
            }
            #endregion

            #region RecGapTo
            var recGapTo = orderMasters.Where(o => o.ReceiveGapTo != orderMaster.ReceiveGapTo);
            if (recGapTo.Count() > 0)
            {
                throw new BusinessException("收货差异调整选项不同不能合并发货。");
            }
            #endregion

            foreach (var orderDetail in orderMaster.OrderDetails)
            {
                orderDetail.RemainShippedQty = orderDetail.OrderedQty > orderDetail.ShippedQty ? orderDetail.OrderedQty - orderDetail.ShippedQty : 0;
                orderDetail.CurrentQty = orderDetail.RemainShippedQty;
            }
            this.orderMasters.Add(orderMaster);
            this.gvListDataBind();
        }
Пример #6
0
        private void CheckAndMerge(OrderMaster orderMaster)
        {

            //if (orderMaster.OrderStrategy == FlowStrategy.KIT)
            //{
            //    if (this.orderMasters != null && this.orderMasters.Count > 0)
            //    {
            //        throw new BusinessException("KIT单不能合并收货。");
            //    }
            //}

            //检查权限
            if (!Utility.HasPermission(orderMaster, base.user))
            {
                throw new BusinessException("没有此订单的权限。");
            }
            if (this.orderMasters == null)
            {
                this.orderMasters = new List<OrderMaster>();
            }
            if (orderMasters.Count(o => o.OrderNo == orderMaster.OrderNo) > 0)
            {
                //订单重复扫描检查
                throw new BusinessException("重复扫描订单。");
            }

            //检查订单类型
            if (orderMaster.Type == OrderType.Production)
            {
                throw new BusinessException("扫描的为生产单,不能收货。");
            }
            else if (orderMaster.Type == OrderType.SubContract)
            {
                throw new BusinessException("扫描的为委外生产单,不能发货。");
            }

            //检查订单状态
            if (orderMaster.Status != OrderStatus.Submit
                && orderMaster.Status != OrderStatus.InProcess)
            {
                throw new BusinessException("不是Submit或InProcess状态不能收货");
            }

            //收货扫描条码 收数量不能再手持设备上做
            if (!orderMaster.IsReceiveScanHu)
            {
                throw new BusinessException("收货不用扫描条码,不能再手持终端上操作。");
            }

            #region IsRecCreateHu
            //var createHuOption = from om in orderMasters
            //                     where om.CreateHuOption == CreateHuOption.Receive
            //                     select om.CreateHuOption;
            //if (createHuOption != null && createHuOption.Count() > 0 && createHuOption.Count() != orderMasters.Count())
            //{
            //    throw new BusinessErrorException("收货创建条码选项不同不能合并发货。");
            //}
            #endregion

            #region 订单类型
            var orderType = orderMasters.Where(o => o.Type != orderMaster.Type);
            if (orderType.Count() > 0)
            {
                throw new BusinessException("订单类型不同不能合并收货。");
            }
            #endregion

            #region 订单质量类型
            var qualityType = orderMasters.Where(o => o.QualityType != orderMaster.QualityType);
            if (qualityType.Count() > 0)
            {
                throw new BusinessException("订单质量状态不同不能合并收货。");
            }
            #endregion

            #region PartyFrom
            var partyFrom = orderMasters.Where(o => o.PartyFrom != orderMaster.PartyFrom);
            if (partyFrom.Count() > 0)
            {
                throw new BusinessException("来源组织不同不能合并收货。");
            }
            #endregion

            #region PartyTo
            var partyTo = orderMasters.Where(o => o.PartyTo != orderMaster.PartyTo);
            if (partyTo.Count() > 0)
            {
                throw new BusinessException("目的组织不同不能合并收货。");
            }
            #endregion

            #region ShipFrom
            var shipFrom = orderMasters.Where(o => o.ShipFrom != orderMaster.ShipFrom);
            if (shipFrom.Count() > 0)
            {
                throw new BusinessException("发货地址不同不能合并收货。");
            }
            #endregion

            #region ShipTo
            var shipTo = orderMasters.Where(o => o.ShipTo != orderMaster.ShipTo);
            if (shipTo.Count() > 0)
            {
                throw new BusinessException("收货地址不同不能合并收货。");
            }
            #endregion

            #region Dock
            var dock = orderMasters.Where(o => o.Dock != orderMaster.Dock);
            if (dock.Count() > 0)
            {
                throw new BusinessException("道口不同不能合并收货。");
            }
            #endregion

            #region IsAutoReceive
            //var isAutoReceive = orderMasters.Where(o => o.IsAutoReceive != orderMaster.IsAutoReceive);
            //if (isAutoReceive.Count() > 1)
            //{
            //    throw new BusinessErrorException("自动收货选项不同不能合并收货。");
            //}
            #endregion

            #region IsShipScanHu
            //var isShipScanHu = orderMasters.Where(o => o.IsShipScanHu != orderMaster.IsShipScanHu);
            //if (isShipScanHu.Count() > 1)
            //{
            //    throw new BusinessErrorException("发货扫描条码选项不同不能合并收货。");
            //}
            #endregion

            #region IsRecScanHu
            var isRecScanHu = orderMasters.Where(o => o.IsReceiveScanHu != orderMaster.IsReceiveScanHu);
            if (isRecScanHu.Count() > 0)
            {
                throw new BusinessException("收货扫描条码选项不同不能合并收货。");
            }
            #endregion

            #region IsRecExceed
            var isRecExceed = orderMasters.Where(o => o.IsReceiveExceed != orderMaster.IsReceiveExceed);
            if (isRecExceed.Count() > 0)
            {
                throw new BusinessException("允许超收选项不同不能合并收货。");
            }
            #endregion

            #region IsRecFulfillUC
            var isRecFulfillUC = orderMasters.Where(o => o.IsReceiveFulfillUC != orderMaster.IsReceiveFulfillUC);
            if (isRecFulfillUC.Count() > 0)
            {
                throw new BusinessException("收货满足包装选项不同不能合并收货。");
            }
            #endregion

            #region IsRecFifo
            var isRecFifo = orderMasters.Where(o => o.IsReceiveFifo != orderMaster.IsReceiveFifo);
            if (isRecFifo.Count() > 0)
            {
                throw new BusinessException("收货先进先出选项不同不能合并收货。");
            }
            #endregion

            #region IsAsnAuotClose
            var isAsnAuotClose = orderMasters.Where(o => o.IsAsnAutoClose != orderMaster.IsAsnAutoClose);
            if (isAsnAuotClose.Count() > 0)
            {
                throw new BusinessException("送货单自动关闭选项不同不能合并收货。");
            }
            #endregion

            #region IsAsnUniqueRec
            //var isAsnUniqueRec = orderMasters.Where(o => o.IsAsnUniqueReceive != orderMaster.IsAsnUniqueReceive);
            //if (isAsnUniqueRec.Count() > 1)
            //{
            //    throw new BusinessErrorException("送货单一次性收货选项不同不能合并收货。");
            //}
            #endregion

            this.orderMasters.Add(orderMaster);
            this.gvListDataBind();
        }
Пример #7
0
        private void Reset()
        {
            this.orderMaster = null;
            this.hus = new List<Hu>();
            this.tbBarCode.Text = string.Empty;
            this.tbBarCode.Focus();
            this.lblMessage.Text = string.Empty;

            this.isCancel = false;
            this.tabPanel.SelectedIndex = 0;

            #region tab1
            this.lblSeqInfo.Text = string.Empty;
            this.lblFlowInfo.Text = string.Empty;
            this.lblWoInfo.Text = string.Empty;
            this.lblVANInfo.Text = string.Empty;
            this.lblFgInfo.Text = string.Empty;
            this.lblFgDescInfo.Text = string.Empty;


            this.lblSeq.Visible = false;
            this.lblFlow.Visible = false;
            this.lblWo.Visible = false;
            this.lblVAN.Visible = false;
            this.lblFg.Visible = false;
            this.lblFgDescription.Visible = false;
            #endregion

            #region tab2
            this.lblVANInfo1.Text = string.Empty;
            this.lblSeqInfo1.Text = string.Empty;
            this.lblStationInfo1.Text = string.Empty;
            //this.lblOpInfo1.Text = string.Empty;
            this.lblItemInfo1.Text = string.Empty;
            this.lblLotNoInfo1.Text = string.Empty;
            this.lblItemRefInfo1.Text = string.Empty;
            this.lblMDateInfo1.Text = string.Empty;
            this.lblMPartyInfo1.Text = string.Empty;
            this.lblItemDescInfo1.Text = string.Empty;


            this.lblVAN1.Visible = false;
            this.lblSeq1.Visible = false;
            this.lblStation1.Visible = false;
            //this.lblOpInfo1.Text = string.Empty;
            this.lblItem1.Visible = false;
            this.lblLotNo1.Visible = false;
            this.lblItemRef1.Visible = false;
            this.lblMDate1.Visible = false;
            this.lblMParty1.Visible = false;
            this.lblItemDesc1.Visible = false;
            #endregion

            this.dgDetail.Visible = false;
            //this.lblMessage.Text ="已全部取消";
            this.keyCodeDiff = Utility.GetKeyCodeDiff();
        }
Пример #8
0
        private void ScanBarCode()
        {
            this.barCode = this.tbBarCode.Text.Trim();
            this.lblMessage.Text = string.Empty;
            this.tbBarCode.Text = string.Empty;

            if (this.barCode.Length < 3)
            {
                throw new BusinessException("条码格式不合法");
            }
            this.op = Utility.GetBarCodeType(this.user.BarCodeTypes, this.barCode);

            if (this.orderMaster == null && this.flowMaster == null)
            {
                if (this.op == CodeMaster.BarCodeType.ORD.ToString())
                {
                    this.Reset();
                    this.lblSeq.Text = "班次:";
                    this.lblFlow.Text = "产线:";
                    this.lblWo.Text = "工单:";
                    var orderMaster = this.smartDeviceService.GetOrder(this.barCode, true);
                    if (orderMaster.IsPause)
                    {
                        throw new BusinessException("订单已暂停");
                    }

                    //检查订单状态
                    if (orderMaster.Status != OrderStatus.Submit && orderMaster.Status != OrderStatus.InProcess)
                    {
                        throw new BusinessException("不是Submit或InProcess状态不能操作");
                    }

                    if (orderMaster.Type == OrderType.Production)
                    {
                        if (orderMaster.OrderDetails.Length != 1)
                        {
                            throw new BusinessException("只能对一料一单的生产单操作");
                        }

                        OrderDetail orderDetail = orderMaster.OrderDetails[0];

                        this.lblSeqInfo.Text = orderMaster.Shift;
                        this.lblFlowInfo.Text = orderMaster.Flow;
                        this.lblWoInfo.Text = orderMaster.OrderNo;
                        this.lblVANInfo.Text = orderMaster.StartTime.ToString("yyyy-MM-dd HH:mm");
                        this.lblFgInfo.Text = orderDetail.Item;
                        this.lblFgDescInfo.Text = orderDetail.ItemDescription;
                        this.tabPanel.SelectedIndex = 0;
                    }
                    else
                    {
                        throw new BusinessException("订单类型不正确:{0}", orderMaster.Type.ToString());
                    }

                    #region 界面控制
                    this.lblSeq.Visible = true;
                    this.lblFlow.Visible = true;
                    this.lblWo.Visible = true;
                    this.lblVAN.Visible = true;
                    this.lblFg.Visible = true;
                    this.lblFgDescription.Visible = true;
                    #endregion

                    this.orderMaster = orderMaster;
                }
                else if (this.op == CodeMaster.BarCodeType.F.ToString())
                {
                    throw new BusinessException("不支持生产线投料");
                    this.Reset();
                    this.barCode = this.barCode.Substring(2, this.barCode.Length - 2);
                    this.flowMaster = smartDeviceService.GetFlowMaster(this.barCode, false);

                    //检查订单类型
                    if (this.flowMaster.Type != OrderType.Production)
                    {
                        throw new BusinessException("不是生产线不能投料。");
                    }

                    //是否有效
                    if (!this.flowMaster.IsActive)
                    {
                        throw new BusinessException("此生产线无效。");
                    }

                    //检查权限
                    if (!Utility.HasPermission(this.flowMaster, this.user))
                    {
                        throw new BusinessException("没有此生产线的权限");
                    }
                    this.lblMessage.Text = this.flowMaster.Description;
                    //this.gvListDataBind();

                    this.lblSeq.Text = "产线:";
                    this.lblSeq.Visible = true;
                    this.lblSeqInfo.Text = this.flowMaster.Code;
                    this.lblFlow.Text = "描述:";
                    this.lblFlow.Visible = true;
                    this.lblFlowInfo.Text = this.flowMaster.Description;
                    this.lblWo.Text = "区域:";
                    this.lblWo.Visible = true;
                    this.lblWoInfo.Text = this.flowMaster.PartyFrom;

                    this.lblVANInfo.Text = string.Empty;

                    this.lblFgInfo.Text = string.Empty;

                    this.lblFgDescInfo.Text = string.Empty;
                    this.tabPanel.SelectedIndex = 0;
                }
                else
                {
                    throw new BusinessException("请先扫描订单或者生产线");
                }
            }
            else
            {
                if (this.op == CodeMaster.BarCodeType.HU.ToString())
                {
                    if (this.hus == null)
                    {
                        this.hus = new List<Hu>();
                    }
                    if (this.flowMaster == null && this.orderMaster == null)
                    {
                        throw new BusinessException("请先扫描生产单或生产线");
                    }

                    Hu hu = new Hu();
                    try
                    {
                        hu = this.smartDeviceService.GetHu(this.barCode);
                    }
                    catch
                    {
                        if (this.barCode.Length == 17)
                        {
                            hu = this.smartDeviceService.ResolveHu(this.barCode, this.user.Code);
                        }
                    }
                    if (string.IsNullOrEmpty(hu.HuId))
                    {
                        throw new BusinessException("条码不存在");
                    }
                    hu.CurrentQty = hu.Qty;
                    var matchHu = this.hus.Where(h => h.HuId.Equals(hu.HuId, StringComparison.OrdinalIgnoreCase));
                    if (matchHu != null && matchHu.Count() > 0)
                    {
                        throw new BusinessException("条码重复扫描!");
                    }
                    if (hu.IsFreeze)
                    {
                        throw new BusinessException("条码被冻结!");
                    }
                    if (hu.OccupyType != OccupyType.None)
                    {
                        throw new BusinessException("条码被{0}占用!", hu.OccupyReferenceNo);
                    }
                    if (!Utility.HasPermission(user.Permissions, null, true, false, hu.Region, null))
                    {
                        throw new BusinessException("没有此条码的权限");
                    }
                    if (hu.Status != HuStatus.Location)
                    {
                        throw new BusinessException("此条码不在库位中");
                    }

                    if (this.orderMaster != null)
                    {
                        this.hus.Insert(0, hu);
                        this.gvHuListDataBind();
                    }
                    else if (this.flowMaster != null)
                    {
                        this.hus.Insert(0, hu);
                        this.gvHuListDataBind();
                    }
                    else
                    {
                        this.Reset();
                        throw new BusinessException("请先扫描生产单或生产线");
                    }

                    this.tabPanel.SelectedIndex = 1;
                }
                else
                {
                    throw new BusinessException("条码格式不合法。");
                }
            }
        }
Пример #9
0
 protected override void Reset()
 {
     this.orderMaster = null;
     //this.orderMasters = new List<OrderMaster>();
     base.Reset();
     //this.effDate = null;
 }
Пример #10
0
 protected override void Reset()
 {
     this.subKitOrders = new List<OrderMaster>();
     this.orderMaster = null;
     this.orderDetailInputs = new List<OrderDetailInput>();
     base.Reset();
     this.lblMessage.Text = "请扫描分装生产单";
     this.effDate = null;
 }
 private void Reset()
 {
     this.orderMaster = null;
     this.huList = new List<Hu>();
     this.isCancel = false;
     //this.numOfScan = 0;
     this.lblItemInfo.Text = string.Empty;
     this.lblRefItemInfo.Text = string.Empty;
     this.lblBarCodeInfo.Text = string.Empty;
     this.lblFlowInfo.Text = string.Empty;
     this.lblStartTimeInfo.Text = string.Empty;
     this.lblVANInfo.Text = string.Empty;
     this.lblWoInfo.Text = string.Empty;
     this.lblSeqInfo.Text = string.Empty;
     this.lblItemDescInfo.Text = string.Empty;
     this.tbBarCode.Text = string.Empty;
     this.lblMessage.Text = string.Empty;
     this.keyCodeDiff = Utility.GetKeyCodeDiff();
 }
        private void ScanBarCode()
        {
            string barCode = this.tbBarCode.Text.Trim();
            this.tbBarCode.Focus();
            this.tbBarCode.Text = string.Empty;
            string op = Utility.GetBarCodeType(this.user.BarCodeTypes, barCode);
            if (barCode.Length < 3)
            {
                throw new BusinessException("条码格式不合法");
            }

            if (this.orderMaster == null)
            {
                if (op == CodeMaster.BarCodeType.ORD.ToString())
                {
                    var orderMaster = this.smartDeviceService.GetOrder(barCode, false);

                    if (orderMaster.IsPause || orderMaster.Status != OrderStatus.Submit)
                    {
                        throw new BusinessException("生产单已暂停或状态不正确");
                    }
                    else if (orderMaster.Type != OrderType.Production)
                    {
                        throw new BusinessException("不是生产单不可以上线{0}", orderMaster.OrderNo);
                    }
                    else
                    {
                        if (!Utility.HasPermission(orderMaster, user))
                        {
                            throw new BusinessException("没有操作生产单{0}的权限", orderMaster.OrderNo);
                        }

                        //this.numOfScan = this.numOfScan + 1;
                        this.lblMessage.Text = "请继续扫描条码或者确认上线";
                        this.lblStartTimeInfo.Text = orderMaster.StartTime.ToString("yyyy-MM-dd HH:mm");
                        this.lblFlowInfo.Text = orderMaster.Flow;
                        this.lblSeqInfo.Text = orderMaster.Sequence.ToString();
                        this.lblVANInfo.Text = orderMaster.TraceCode;
                        this.lblWoInfo.Text = orderMaster.OrderNo;
                        this.orderMaster = orderMaster;
                    }
                }
                else
                {
                    this.Reset();
                    this.lblMessage.Text = "";
                    throw new BusinessException("请先扫描生产单");
                }
            }
            else
            {
                if (barCode.Length == 17 && this.smartDeviceService.IsValidLotNo(barCode.Substring(9, 4)) == true)
                {
                    op = CodeMaster.BarCodeType.HU.ToString();
                }
                if (op == CodeMaster.BarCodeType.ORD.ToString())
                {
                    Hu hu = null;// smartDeviceService.GetHuByOrderNo(barCode);
                    if (hu == null)
                    {
                        throw new BusinessException("未找到子生产单{0}的下线条码。", orderMaster.OrderNo);
                    }
                    else if (huList.Count()>0 && huList.Where(h => h.HuId == hu.HuId).Count()>0)
                    {
                        throw new BusinessException("子生产单{0}已扫描。", orderMaster.OrderNo);
                    }

                    if (hu.IsFreeze)
                    {
                        throw new BusinessException("条码被冻结。");
                    }
                    if (hu.OccupyType != OccupyType.None)
                    {
                        throw new BusinessException("条码被{0}占用。", hu.OccupyReferenceNo);
                    }
                    //if (!smartDeviceService.VerifyOrderCompareToHu(this.orderMaster.OrderNo, hu.HuId))
                    //{
                    //    throw new BusinessException("物料{0}不能投到生产单{1}", this.orderMaster.OrderNo, hu.HuId);
                    //}
                    huList.Insert(0, hu);

                    this.lblBarCodeInfo.Text = hu.HuId;
                    this.lblItemDescInfo.Text = hu.ItemDescription;
                    this.lblRefItemInfo.Text = hu.ReferenceItemCode;
                    this.lblItemInfo.Text = hu.Item;
                    return;
                }
                else if (op == CodeMaster.BarCodeType.HU.ToString())
                {
                    Hu hu = new Hu();
                    try
                    {
                        hu = this.smartDeviceService.GetHu(barCode);
                        if (!string.IsNullOrEmpty(hu.OrderNo))
                        {
                            hu.OrderNo = string.Empty;
                        }
                    }
                    catch
                    {
                        if (barCode.Length == 17)
                        {
                            hu = this.smartDeviceService.ResolveHu(barCode, this.user.Code);
                            hu.IsEffective = false;
                        }
                    }
                    if (hu == null)
                    {
                        throw new BusinessException("条码不存在");
                    }
                    hu.CurrentQty = hu.Qty;
                    var matchHu = this.huList.Where(h => h.HuId.Equals(hu.HuId, StringComparison.OrdinalIgnoreCase));
                    if (matchHu != null && matchHu.Count() > 0)
                    {
                        throw new BusinessException("条码重复扫描!");
                    }
                    if (hu.IsFreeze)
                    {
                        throw new BusinessException("条码被冻结!");
                    }
                    if (hu.OccupyType != OccupyType.None)
                    {
                        throw new BusinessException("条码被{0}占用!", hu.OccupyReferenceNo);
                    }
                    if (!Utility.HasPermission(user.Permissions, null, true, false, hu.Region, null))
                    {
                        throw new BusinessException("没有此条码的权限");
                    }
                    //if (hu.Status != HuStatus.Location)
                    //{
                    //    throw new BusinessException("条码不在库存中,不能投料");
                    //}
                    if (hu.Status != HuStatus.Location)
                    {
                        if (this.location == null)
                        {
                            throw new BusinessException("请先扫描库位条码。");
                        }
                        hu.IsEffective = false;
                    }

                    //if (!smartDeviceService.VerifyOrderCompareToHu(this.orderMaster.OrderNo, hu.HuId))
                    //{
                    //    throw new BusinessException("物料{0}不能投到生产单{1}", this.orderMaster.OrderNo, hu.HuId);
                    //}
                    huList.Insert(0, hu);
                    this.lblBarCodeInfo.Text = hu.HuId;
                    this.lblItemDescInfo.Text = hu.ItemDescription;
                    this.lblRefItemInfo.Text = hu.ReferenceItemCode;
                    this.lblItemInfo.Text = hu.Item;
                    return;

                }
                else if (op == CodeMaster.BarCodeType.L.ToString())
                {
                    barCode = barCode.Substring(2, barCode.Length - 2);
                    Location location = smartDeviceService.GetLocation(barCode);

                    //检查权限
                    if (!Utility.HasPermission(user.Permissions, OrderType.Transfer, false, true, null, location.Region))
                    {
                        throw new BusinessException("没有此区域的权限");
                    }
                    this.location = location;
                }
                else
                {
                    throw new BusinessException("条码格式不合法");
                }
            }
        }
Пример #13
0
        private void Reset()
        {
            this.orderMaster = null;
            this.huIds = new List<string>();
            this.tbBarCode.Text = string.Empty;
            //this.tbBarCode.Focus();

            this.isCancel = false;

            this.lblVANInfo.Text = string.Empty;


            this.lblVAN.Visible = false;

            this.LBScanhuList.Items.Clear();
            this.traceCode = string.Empty;
            this.lblMessage.Text ="已全部取消,请扫描Van号";
        }
Пример #14
0
        private void ScanBarCode()
        {
            this.barCode = this.tbBarCode.Text.Trim();
            this.lblMessage.Text = string.Empty;
            this.tbBarCode.Text = string.Empty;

            if (this.barCode.Length < 3)
            {
                throw new BusinessException("条码格式不合法");
            }
            op = Utility.GetBarCodeType(this.user.BarCodeTypes, this.barCode);
            #region ORD
            if (this.op == CodeMaster.BarCodeType.ORD.ToString())
            {
                #region 扫描整车生产单
                orderMaster = this.smartDeviceService.GetOrder(barCode, false);
                if (orderMaster.Type != OrderType.Production
                   || orderMaster.ProdLineType != ProdLineType.Chassis
                   || orderMaster.ProdLineType != ProdLineType.Cab
                   || orderMaster.ProdLineType != ProdLineType.Assembly
                   || orderMaster.ProdLineType != ProdLineType.Special)
                {
                    if (orderMaster.PauseStatus == PauseStatus.Paused)
                    {
                        throw new BusinessException("整车生产单已暂停不能上线");
                    }
                    else if (orderMaster.Status != OrderStatus.Submit)
                    {
                        throw new BusinessException("整车生产单已经上线");
                    }
                    else
                    {
                        if (!Utility.HasPermission(orderMaster, user))
                        {
                            throw new BusinessException("没有驾驶室上线的权限");
                        }
                        this.lblSeqInfo.Text = orderMaster.Sequence.ToString();
                        this.lblFlowInfo.Text = orderMaster.Flow;
                        this.lblWoInfo.Text = orderMaster.OrderNo;
                        this.lblVANInfo.Text = orderMaster.TraceCode;
                        this.lblStartTime.Text = orderMaster.StartTime.ToString();
                        this.lblMessage.Text = " 请扫描关键件。 ";
                    }
                }
                else
                {
                    this.Reset();
                    this.lblMessage.Text = "";
                    throw new BusinessException("扫描的不是整车生产单");
                }
                #endregion
            }
            #endregion

            #region HU
            else if (this.op == CodeMaster.BarCodeType.HU.ToString())
            {

                if (this.orderMaster == null)
                {
                    throw new BusinessException("请先扫描生产单");
                }



                if (this.orderMaster != null)
                {
                    if (this.orderMaster.Type == OrderType.Production)
                    {
                        #region 扫描关键件
                        qualityBarcode = this.smartDeviceService.GetQualityBarCode(barCode);
                        this.lblBarCodeInfo.Text = barCode;
                        this.lblItemDescInfo.Text = qualityBarcode.ItemDescription;
                        this.lblItemInfo.Text = qualityBarcode.Item;
                        this.lblRefItemInfo.Text = qualityBarcode.ReferenceItemCode;
                        this.lblMessage.Text = " 请点击确认。 ";
                        #endregion

                        //this.lblVANInfo.Text = this.orderMaster.TraceCode;
                    }
                }
                else
                {
                    this.Reset();
                    throw new BusinessException("请先扫描生产单");
                }

            }
            #endregion
            else
            {
                throw new BusinessException("条码格式不合法1");
            }
        }
Пример #15
0
        protected override void ScanBarCode()
        {
            base.ScanBarCode();

            if (this.isCancel == false)
            {
                if (this.orderMaster == null)
                {
                    var orderMaster = new OrderMaster();
                    if (base.op == CodeMaster.BarCodeType.ORD.ToString())
                    {
                        orderMaster = this.smartDeviceService.GetOrder(base.barCode, true);
                        //if (orderMaster.OrderStrategy != FlowStrategy.KIT)
                        //{
                        //    throw new BusinessException("该订单不是KIT单,请扫描KIT");
                        //}
                        if (orderMaster.Status != OrderStatus.Close)
                        {
                            throw new BusinessException("KIT单{0}未关闭", base.barCode);
                        }
                        //orderMaster.OrderDetails = orderMaster.OrderDetails.Where(o => o.IsScanHu == true).ToArray();
                        this.lblMessage.Text = "请扫描关键件条码";
                        this.orderMaster = orderMaster;
                        this.gvListDataBind();
                    }
                    else
                    {
                        throw new BusinessException("请先扫描KIT单");
                    }
                }
                else
                {

                    if (base.barCode.Length == 17 && Utility.IsValidateLotNo(base.barCode.Substring(9, 4)) == true)
                    {
                        base.op = CodeMaster.BarCodeType.HU.ToString();
                    }
                    if (base.op == CodeMaster.BarCodeType.HU.ToString())
                    {
                        if (this.orderMaster == null)
                        {
                            throw new BusinessException("请先扫描KIT单");
                        }
                        Hu hu = new Hu();
                        try
                        {
                            hu = this.smartDeviceService.GetHu(this.barCode);
                        }
                        catch
                        {
                            if (this.barCode.Length == 17)
                            {
                                hu = this.smartDeviceService.ResolveHu(this.barCode, this.user.Code);
                            }
                        }
                        if (string.IsNullOrEmpty(hu.HuId))
                        {
                            throw new BusinessException("条码没有找到。");
                        }
                        
                        if (this.orderMaster.OrderDetails.Where(od => od.Item != hu.Item && od.IsScanHu == true).Count()>0)
                        {
                            throw new BusinessException("条码{0}不是KIT单{1}所需要的关键件", hu.HuId, this.orderMaster.OrderNo);
                        }
                        
                        OrderDetail orderDetail = this.orderMaster.OrderDetails.FirstOrDefault(o => o.Item == hu.Item);
                        if (orderDetail.QualityType != hu.QualityType)
                        {
                            throw new BusinessException("条码的质量不满足需求");
                        }

                        if (hu.Status == HuStatus.Location)
                        {
                            throw new BusinessException("条码{0}已经在库位中", base.barCode);
                        }
                        orderDetail.IsScanHu = false;
                        this.hus.Add(hu);
                        this.gvListDataBind();
                        //this.MatchHu(hu);
                    }
                    else
                    {
                        throw new BusinessException("条码格式不合法");
                    }
                }
            }
            else
            {
                if (base.op == CodeMaster.BarCodeType.HU.ToString())
                {
                    if(this.hus.All(h=>h.HuId != base.barCode))
                    {
                        throw new BusinessException("该条码未扫入不需要取消");
                    }
                    Hu hu = this.hus.FirstOrDefault(h => h.HuId == base.barCode);

                    OrderDetail orderDetail = this.orderMaster.OrderDetails.FirstOrDefault(o => o.Item == hu.Item);

                    orderDetail.IsScanHu = true;
                    this.hus.Add(hu);
                    this.gvListDataBind();
                }
                else
                {
                    throw new BusinessException("条码格式不合法");
                }
            }
        }
Пример #16
0
        private void Reset()
        {
            this.orderMaster = null;
            this.hus = new List<Hu>();
            this.tbBarCode.Text = string.Empty;
            //this.tbBarCode.Focus();
            this.lblMessage.Text = string.Empty;

            this.isCancel = false;
            this.lblBarCode.ForeColor = Color.Black;
            this.tabPanel.SelectedIndex = 0;

            #region tab1
            this.lblSeqInfo.Text = string.Empty;
            this.lblFlowInfo.Text = string.Empty;
            this.lblWoInfo.Text = string.Empty;
            this.lblVANInfo.Text = string.Empty;
            this.lblFgInfo.Text = string.Empty;
            this.lblFgDescInfo.Text = string.Empty;


            this.lblSeq.Visible = false;
            this.lblFlow.Visible = false;
            this.lblWo.Visible = false;
            this.lblVAN.Visible = false;
            this.lblFg.Visible = false;
            this.lblFgDescription.Visible = false;
            #endregion

            this.dgDetail.Visible = false;
            //this.lblMessage.Text ="已全部取消";
        }
Пример #17
0
 private void Reset()
 {
     this.traceCode = string.Empty;
     this.orderMaster = null;
     this.huIds = new List<string>();
     this.lblVANInfo.Text = "";
     this.LBScanhuList.Items.Clear();
 }
Пример #18
0
        protected override void ScanBarCode()
        {
            base.ScanBarCode();

            if (this.orderMaster == null)
            {
                if (base.op == CodeMaster.BarCodeType.ORD.ToString())
                {
                    //var orderMaster = base.smartDeviceService.GetOrderKeyParts(base.barCode);
                    if (orderMaster.PauseStatus == PauseStatus.Paused)
                    {
                        throw new BusinessException("订单已暂停");
                    }
                    //检查订单类型
                    //else if (orderMaster.Type != OrderType.Transfer && orderMaster.OrderStrategy != FlowStrategy.KIT)
                    //{
                    //    throw new BusinessException("扫描的单号不为分装生产单。");
                    //}
                    //检查订单状态,应该为Close
                    //else if (orderMaster.Status != OrderStatus.Close)
                    //{
                    //    throw new BusinessException("扫描的分装生产单状态不正确");
                    //}
                    List<OrderDetail> orderDetails = new List<OrderDetail>();
                    List<OrderMaster> kitOrders = null;//this.smartDeviceService.GetKitBindingOrders(orderMaster.OrderNo).ToList();
                    foreach (var kitOrder in kitOrders)
                    {
                        var orderDetail = new OrderDetail();
                        orderDetail.Item = kitOrder.OrderNo;
                        orderDetail.CurrentQty = 1;
                        orderDetail.OrderedQty = 1;
                        orderDetail.IsScanHu = true;
                        orderDetail.ItemDescription = "分装生产单";
                        orderDetails.Add(orderDetail);
                    }

                    orderMaster.OrderDetails = orderMaster.OrderDetails.Union(orderDetails).ToArray();
                    this.lblMessage.Text = "请扫描关键件条码或者子生产单。";
                    this.orderMaster = orderMaster;
                    this.gvListDataBind();
                    //this.MergeOrderMaster(orderMaster);
                }
                else
                {
                    throw new BusinessException("请扫描分装生产单。");
                }
            }
            else
            {
                if (base.barCode.Length == 17 && Utility.IsValidateLotNo(base.barCode.Substring(9, 4)) == true)
                {
                    base.op = CodeMaster.BarCodeType.HU.ToString();
                }
                if (base.op == CodeMaster.BarCodeType.HU.ToString())
                {

                    Hu hu = new Hu();
                    try
                    {
                        hu = this.smartDeviceService.GetHu(this.barCode);
                    }
                    catch
                    {
                        if (this.barCode.Length == 17)
                        {
                            hu = this.smartDeviceService.ResolveHu(this.barCode, this.user.Code);
                        }
                    }
                    this.MatchHu(hu);
                }
                else if (base.op == CodeMaster.BarCodeType.ORD.ToString())
                {
                    if (isCancel)
                    {
                        if (this.hus.Any(h => h.HuId == base.barCode))
                        {
                            this.hus.Remove(this.hus.FirstOrDefault(h => h.HuId == base.barCode));
                        }
                        else
                        {
                            throw new BusinessException("条码未扫入,不可以取消");
                        }
                    }
                    else
                    {
                        var orderMaster = base.smartDeviceService.GetOrder(base.barCode, false);
                        if (orderMaster.PauseStatus == PauseStatus.Paused)
                        {
                            throw new BusinessException("订单已暂停");
                        }
                        //检查订单类型
                        //else if (orderMaster.Type != OrderType.Transfer && orderMaster.OrderStrategy != FlowStrategy.KIT)
                        //{
                        //    throw new BusinessException("扫描的单号不为分装生产单。");
                        //}
                        else if (orderMaster.Status != OrderStatus.Close)
                        {
                            throw new BusinessException("扫描的分装生产单未关闭");
                        }
                        else if (this.orderMaster.OrderDetails.All(o => o.Item != base.barCode))
                        {
                            throw new BusinessException("分装生产单{0}不是生产单{1}的子生产单", base.barCode, this.orderMaster.OrderNo);
                        }
                        
                        var orderDetail = this.orderMaster.OrderDetails.FirstOrDefault(h => h.Item == base.barCode);
                        orderDetail.ReceivedQty = 1;
                        orderDetail.CurrentQty = 0;
                        Hu hu = new Hu();
                        hu.HuId = orderMaster.OrderNo;
                        hu.Item = orderMaster.OrderNo;
                        hu.ItemDescription = "分装生产单";
                        this.hus.Add(hu);
                        this.subKitOrders.Add(orderMaster);
                        this.gvListDataBind();
                        this.lblMessage.Text = "请扫描关键件条码或者子生产单。";
                    }
                }
                else if (this.op == CodeMaster.BarCodeType.L.ToString())
                {
                    this.barCode = this.barCode.Substring(2, this.barCode.Length - 2);
                    Location location = smartDeviceService.GetLocation(this.barCode);

                    //检查权限
                    if (!Utility.HasPermission(user.Permissions, OrderType.Transfer, false, true, null, location.Region))
                    {
                        throw new BusinessException("没有此区域的权限");
                    }
                    this.location = location;
                }
                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("条码格式不合法");
                }
            }
        }