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 }
private void Reset() { this.hus = new List<Hu>(); this.flowMaster = null; this.tbBarCode.Text = string.Empty; this.tbBarCode.Focus(); this.lblMessage.Text = string.Empty; this.lblFlowDescInfo.Text = string.Empty; this.lblFlowInfo.Text = string.Empty; this.tabPanel.SelectedIndex = 0; this.dgDetail.Visible = false; this.keyCodeDiff = Utility.GetKeyCodeDiff(); this.lblMessage.Text = "请先扫描路线"; }
public static bool HasPermission(FlowMaster flowMaster, User user) { return HasPermission(user.Permissions, flowMaster.Type, flowMaster.IsCheckPartyFromAuthority, flowMaster.IsCheckPartyToAuthority, flowMaster.PartyFrom, flowMaster.PartyTo); }
/// <remarks/> public System.IAsyncResult BeginDoTransfer(FlowMaster flowMaster, OrderDetailInput[] orderDetailInputList, string userCode, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("DoTransfer", new object[] { flowMaster, orderDetailInputList, userCode}, callback, asyncState); }
private void ScanBarCode() { string barCode = this.tbBarCode.Text.Trim(); this.lblMessage.Text = string.Empty; this.tbBarCode.Text = string.Empty; if (barCode.Length < 3) { throw new BusinessException("条码格式不合法"); } string op = Utility.GetBarCodeType(this.user.BarCodeTypes, barCode); if (this.flowMaster == null) { if (op == CodeMaster.BarCodeType.F.ToString()) { barCode = barCode.Substring(2, barCode.Length - 2); this.flowMaster = smartDeviceService.GetFlowMaster(barCode, true); if (!Utility.HasPermission(flowMaster, user)) { throw new BusinessException("没有此路线的操作权限"); } this.lblMessage.Text = "请扫描需要退货的条码"; this.lblFlowInfo.Text = this.flowMaster.Code; this.lblFlowDescInfo.Text = this.flowMaster.Description; this.tabPanel.SelectedIndex = 0; } else { throw new BusinessException("条码格式不合法"); } } else { #region HU if (op == CodeMaster.BarCodeType.HU.ToString()) { if (this.hus == null) { this.hus = new List<Hu>(); } if (this.flowMaster == null) { throw new BusinessException("请先扫描物流路线"); } Hu hu = smartDeviceService.GetHu(barCode); if (hu == null) { throw new BusinessException("条码不存在"); } 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.flowMaster != null) { var flowDetails = this.flowMaster.FlowDetails ?? new FlowDetail[] { }; if (!flowDetails.Select(p => p.Item).Contains(hu.Item)) { throw new BusinessException("物料明细不匹配,不能退库"); } hu.CurrentQty = hu.Qty; this.hus.Insert(0, hu); this.gvHuListDataBind(); } else { this.Reset(); throw new BusinessException("请先扫描物流路线"); } this.tabPanel.SelectedIndex = 1; } #endregion else if (op == CodeMaster.BarCodeType.DATE.ToString()) { barCode = barCode.Substring(2, barCode.Length - 2); this.effDate = this.smartDeviceService.GetEffDate(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("条码格式不合法1"); } } }
protected override void ScanBarCode() { base.ScanBarCode(); if (this.flowMaster == null) { if (base.op == CodeMaster.BarCodeType.F.ToString()) { base.barCode = base.barCode.Substring(2, base.barCode.Length - 2); var flowMaster = smartDeviceService.GetFlowMaster(base.barCode, true); //检查订单类型 if (flowMaster.Type != OrderType.Transfer) { throw new BusinessException("不是移库路线。"); } //是否有效 if (!flowMaster.IsActive) { throw new BusinessException("此移库路线无效。"); } //检查权限 if (!Utility.HasPermission(flowMaster, base.user)) { throw new BusinessException("没有此移库路线的权限"); } this.flowMaster = flowMaster; base.lblMessage.Text = this.flowMaster.Description; this.gvListDataBind(); } else if (base.op == CodeMaster.BarCodeType.B.ToString()) { base.barCode = base.barCode.Substring(2, base.barCode.Length - 2); Bin bin = smartDeviceService.GetBin(base.barCode); //检查权限 if (!Utility.HasPermission(user.Permissions, OrderType.Transfer, false, true, null, bin.Region)) { throw new BusinessException("没有此移库路线的权限"); } this.flowMaster = new FlowMaster(); this.flowMaster.PartyTo = bin.Region; this.flowMaster.LocationTo = bin.Location; this.flowMaster.Bin = bin.Code; this.lblMessage.Text = "目的库格:" + bin.Code; } else if (base.op == CodeMaster.BarCodeType.L.ToString()) { base.barCode = base.barCode.Substring(2, base.barCode.Length - 2); Location location = smartDeviceService.GetLocation(base.barCode); //检查权限 if (!Utility.HasPermission(user.Permissions, OrderType.Transfer, false, true, null, location.Region)) { throw new BusinessException("没有此移库路线的权限"); } this.flowMaster = new FlowMaster(); this.flowMaster.PartyTo = location.Region; this.flowMaster.LocationTo = location.Code; this.lblMessage.Text = "目的库位:" + location.Code; } else { throw new BusinessException("输入的库位或路线条码不正确。"); } } else { if (base.op == CodeMaster.BarCodeType.HU.ToString()) { if (this.flowMaster == null) { throw new BusinessException("请先扫描路线或库位或库格"); } Hu hu = smartDeviceService.GetHu(barCode); this.MatchHu(hu); } else if (base.op == CodeMaster.BarCodeType.DATE.ToString()) { //todo 权限校验 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(); this.flowMaster.EffectiveDate = effDate; } else { throw new BusinessException("条码格式不合法"); } } }
public void DoTransfer(FlowMaster flowMaster, OrderDetailInput[] orderDetailInputList, string userCode) { this.Invoke("DoTransfer", new object[] { flowMaster, orderDetailInputList, userCode}); }
protected override void Reset() { this.flowMaster = null; base.Reset(); //this.lblMessage.Text = "请先扫描路线或库位或库格"; this.effDate = null; }
private FlowDetail Hu2FlowDetail(FlowMaster flowMaster, Hu hu) { //int seq = 10; //if (flowMaster.FlowDetails != null) //{ // seq = flowMaster.FlowDetails.Max(f => f.Sequence) + 10; //} FlowDetail flowDetail = new FlowDetail(); flowDetail.Id = this.FindMinId() - 1; //flowDetail.CurrentQty = hu.UnitCount; flowDetail.Flow = flowMaster.Code; flowDetail.Item = hu.Item; flowDetail.LocationFrom = flowMaster.LocationFrom; flowDetail.LocationTo = flowMaster.LocationTo; flowDetail.ReferenceItemCode = hu.ReferenceItemCode; //flowDetail.Sequence = seq; flowDetail.UnitCount = hu.UnitCount; flowDetail.Uom = hu.Uom; return flowDetail; }
private FlowDetail Item2FlowDetail(FlowMaster flowMaster, Item item) { int seq = 10; if (flowMaster.FlowDetails != null) { seq = flowMaster.FlowDetails.Max(f => f.Sequence) + 10; } FlowDetail flowDetail = new FlowDetail(); flowDetail.CurrentQty = item.UnitCount; flowDetail.Flow = flowMaster.Code; flowDetail.Item = item.Code; flowDetail.LocationFrom = flowMaster.LocationFrom; flowDetail.LocationTo = flowMaster.LocationTo; flowDetail.ReferenceItemCode = item.ReferenceCode; flowDetail.Sequence = seq; flowDetail.UnitCount = item.UnitCount; flowDetail.Uom = item.Uom; return flowDetail; }
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("条码格式不合法。"); } } }
private void MatchItem(FlowMaster flowMaster, Item item) { var flowDetails = flowMaster.FlowDetails; Hu hu = new Hu(); hu.HuId = flowMaster.Code; hu.CurrentQty = item.UnitCount; hu.Item = item.Code; hu.Uom = item.Uom; hu.ReferenceItemCode = item.ReferenceCode; hu.ItemDescription = item.Description; ; hu.UnitCount = item.UnitCount; hu.Uom = item.Uom; if (isCancel) { this.CancelHu(hu); } else { if (flowMaster.IsManualCreateDetail) { if (flowDetails != null) { var q = flowDetails.Where(f => f.Item.Equals(item.Code, StringComparison.OrdinalIgnoreCase)); if (q.Count() > 0) { var firstFlowDetail = q.First(); firstFlowDetail.CurrentQty += item.UnitCount; firstFlowDetail.Carton++; } else { List<FlowDetail> flowDetailList = flowDetails.ToList(); flowDetailList.Add(Item2FlowDetail(flowMaster, item)); flowMaster.FlowDetails = flowDetailList.ToArray(); } } else { List<FlowDetail> flowDetailList = new List<FlowDetail>(); flowDetailList.Add(Item2FlowDetail(flowMaster, item)); flowMaster.FlowDetails = flowDetailList.ToArray(); } } else { #region 物料匹配 if (flowDetails == null) { throw new BusinessException("没有找到和路线{0}的零件号{1}匹配的明细。", flowMaster.Code, item.Code); } var matchedOrderDetailList = flowDetails.Where(o => o.Item == item.Code); if (matchedOrderDetailList == null || matchedOrderDetailList.Count() == 0) { throw new BusinessException("没有找到和路线{0}的零件号{1}匹配的明细。", flowMaster.Code, item.Code); } matchedOrderDetailList = matchedOrderDetailList.Where(o => o.Uom.Equals(item.Uom, StringComparison.OrdinalIgnoreCase)); if (matchedOrderDetailList == null || matchedOrderDetailList.Count() == 0) { throw new BusinessException("没有找到和路线{0}的单位{1}匹配的订单明细。", flowMaster.Code, item.Code); } if (flowMaster.IsOrderFulfillUC) { matchedOrderDetailList = matchedOrderDetailList.Where(o => o.UnitCount == item.UnitCount); if (matchedOrderDetailList == null || matchedOrderDetailList.Count() == 0) { throw new BusinessException("没有找到和路线{0}的包装数{1}匹配的订单明细。", flowMaster.Code, item.UnitCount.ToString()); } } FlowDetail matchedFlowDetail = matchedOrderDetailList.First(); #endregion matchedFlowDetail.CurrentQty += item.UnitCount; matchedFlowDetail.Carton++; } if (this.hus == null) { this.hus = new List<Hu>(); } this.hus.Insert(0, hu); } // this.gvListDataBind(); }
protected override void ScanBarCode() { base.ScanBarCode(); if (this.flowMaster == null) { if (base.op == CodeMaster.BarCodeType.F.ToString()) { base.barCode = base.barCode.Substring(2, base.barCode.Length - 2); var flowMaster = smartDeviceService.GetFlowMaster(base.barCode, true); //检查订单类型 if (flowMaster.Type != OrderType.Transfer || flowMaster.Type != OrderType.SubContractTransfer) { throw new BusinessException("不是移库路线。"); } //是否有效 if (!flowMaster.IsActive) { throw new BusinessException("此移库路线无效。"); } //检查权限 if (!Utility.HasPermission(flowMaster, base.user)) { throw new BusinessException("没有此移库路线的权限"); } this.flowMaster = flowMaster; base.lblMessage.Text = this.flowMaster.Description; this.gvListDataBind(); } else { throw new BusinessException("输入的条码类型不正确。"); } } else { if (base.op == CodeMaster.BarCodeType.HU.ToString()) { if (this.flowMaster == null) { throw new BusinessException("请先扫描物流路线"); } Hu hu = smartDeviceService.GetHu(barCode); this.MatchHu(hu); } else if (base.op == CodeMaster.BarCodeType.DATE.ToString()) { //todo 权限校验 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(); this.flowMaster.EffectiveDate = effDate; } else { throw new BusinessException("条码格式不合法"); } } }
private void CheckAndMerge(OrderMaster orderMaster) { if (orderMaster.OrderStrategy == FlowStrategy.KIT && this.orderMasters.Count > 0) { throw new BusinessException("KIT单不能合并收货。"); } //检查权限 if (!Utility.HasPermission(orderMaster, base.user)) { throw new BusinessException("没有此订单的权限。"); } VerifyPermission(orderMaster.PartyTo); 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("ASN自动关闭选项不同不能合并收货。"); } #endregion #region IsAsnUniqueRec //var isAsnUniqueRec = orderMasters.Where(o => o.IsAsnUniqueReceive != orderMaster.IsAsnUniqueReceive); //if (isAsnUniqueRec.Count() > 1) //{ // throw new BusinessErrorException("ASN一次性收货选项不同不能合并收货。"); //} #endregion if (this.flowMaster == null) { this.flowMaster = this.smartDeviceService.GetFlowMaster(orderMaster.Flow, false); } //分装生产单不能直接收货 if (orderMaster.OrderStrategy == FlowStrategy.KIT && !string.IsNullOrEmpty(this.flowMaster.Routing)) { throw new BusinessException("分装生产单不可以收货。"); } //KIT单不能合并收货 if (this.orderMasters.Count > 0) { if (orderMaster.OrderStrategy == FlowStrategy.KIT) { throw new BusinessException("KIT单不能合并收货"); } } this.orderMasters.Add(orderMaster); this.gvListDataBind(); }
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; }
private void Reset() { this.hus = new List<Hu>(); this.flowMaster = null; this.tbBarCode.Text = string.Empty; //this.tbBarCode.Focus(); this.lblMessage.Text = string.Empty; this.lblFlowDescInfo.Text = string.Empty; this.lblFlowInfo.Text = string.Empty; this.isCancel = false; this.tabPanel.SelectedIndex = 0; this.dgDetail.Visible = false; //this.lblMessage.Text ="已全部取消"; }