Inheritance: FlowDetailBase
Exemplo n.º 1
0
        public void AddFlowDetail(FlowDetail flowDetail)
        {
            if (this.FlowDetails == null)
            {
                this.FlowDetails = new List <FlowDetail>();
            }

            this.FlowDetails.Add(flowDetail);
        }
Exemplo n.º 2
0
        public void AddFlowDetail(FlowDetail flowDetail)
        {
            if (this.FlowDetails == null)
            {
                this.FlowDetails = new List<FlowDetail>();
            }

            this.FlowDetails.Add(flowDetail);
        }
Exemplo n.º 3
0
        public override void CreateFlowDetail(FlowDetail entity)
        {
            base.CreateFlowDetail(entity);

            flowDetailTrackMgr.CreateFlowDetailTrack(entity, BusinessConstants.TRACK_EVENT_CREATE);

            //Flow flow = entity.Flow;
            //flow.LastModifyDate = DateTime.Now;
            //flowDao.UpdateFlow(flow);
        }
Exemplo n.º 4
0
        public static Transformer ConvertFlowDetailToTransformer(FlowDetail flowDetail)
        {
            if (flowDetail == null)
                return null;

            Transformer transformer = new Transformer();
            transformer.ItemCode = flowDetail.Item.Code;
            transformer.ItemDescription = flowDetail.Item.Description;
            transformer.ReferenceItemCode = flowDetail.ReferenceItemCode;
            transformer.UomCode = flowDetail.Uom.Code;
            transformer.UnitCount = flowDetail.UnitCount;
            transformer.LocationFromCode = flowDetail.DefaultLocationFrom != null ? flowDetail.DefaultLocationFrom.Code : null;
            transformer.LocationToCode = flowDetail.DefaultLocationTo != null ? flowDetail.DefaultLocationTo.Code : null;

            return transformer;
        }
Exemplo n.º 5
0
        public void CreateFlowDetailTrack(FlowDetail flowDetail,string eventCode)
        {
            FlowDetailTrack flowDetailTrack = new FlowDetailTrack();
            CloneHelper.CopyProperty(flowDetail, flowDetailTrack, FlowDetail2FlowDetailTrackCloneFields);
            flowDetailTrack.FlowDetailId = flowDetail.Id;
            flowDetailTrack.Flow = flowDetail.Flow.Code;
            flowDetailTrack.Item = flowDetail.Item.Code;
            flowDetailTrack.Customer = flowDetail.Customer != null ? flowDetail.Customer.Code : string.Empty;
            flowDetailTrack.Uom = flowDetail.Uom != null ? flowDetail.Uom.Code : string.Empty;
            flowDetailTrack.Bom = flowDetail.Bom != null ? flowDetail.Bom.Code : string.Empty;
            flowDetailTrack.BillFrom = flowDetail.BillFrom != null ? flowDetail.BillFrom.Code : string.Empty;
            flowDetailTrack.BillTo = flowDetail.BillTo != null ? flowDetail.BillTo.Code : string.Empty;
            flowDetailTrack.LocationFrom = flowDetail.LocationFrom != null ? flowDetail.LocationFrom.Code : string.Empty;
            flowDetailTrack.LocationTo = flowDetail.LocationTo != null ? flowDetail.LocationTo.Code : string.Empty;
            flowDetailTrack.LastModifyUser = flowDetail.LastModifyUser.Code;
            flowDetailTrack.LastModifyDate = DateTime.Now;
            flowDetailTrack.PriceListFrom = flowDetail.PriceListFrom != null ? flowDetail.PriceListFrom.Code : string.Empty;
            flowDetailTrack.PriceListTo = flowDetail.PriceListTo != null ? flowDetail.PriceListTo.Code : string.Empty;
            flowDetailTrack.EventCode = eventCode;

            base.CreateFlowDetailTrack(flowDetailTrack);
        }
        public SupplyChain GenerateSupplyChain(Flow flow, FlowDetail flowDetail)
        {
            SupplyChain supplyChain = new SupplyChain();
            supplyChain.Flow = flow;
            supplyChain.FlowDetail = flowDetail;

            SupplyChainDetail supplyChainDetail = new SupplyChainDetail();
            supplyChainDetail.SupplyChain = supplyChain;
            supplyChainDetail.Id = 1;
            supplyChainDetail.ParentId = 0;
            supplyChainDetail.Flow = flow;
            supplyChainDetail.FlowDetail = flowDetail;
            supplyChainDetail.LocationTo = flowDetail.DefaultLocationTo == null ? null : flowDetail.DefaultLocationTo;
            supplyChainDetail.QuantityPer = 1;

            IList<SupplyChainDetail> supplyChainDetailList = new List<SupplyChainDetail>();
            supplyChainDetailList.Add(supplyChainDetail);
            this.GetSupplyChainDetail(supplyChainDetailList, supplyChainDetail);

            supplyChain.AddRangeSupplyChainDetail(supplyChainDetailList);
            return supplyChain;
        }
Exemplo n.º 7
0
        public string GenerateFGHuId(FlowDetail flowDetail, string shiftCode, decimal qty, string idMark)
        {
            #region ��Ʒ����
            //if (flowDetail.BarCodeType == BusinessConstants.CODE_MASTER_FINISH_GOODS_BAR_CODE_TYPE_VALUE_DEFAULT)
            //{

            //}
            //else
            //{

            //}
            //������ʶ����2λ����Ʒʶ����(1λ) ����������4λ (����ͬ5.5.1.2�еĹ������ڱ���) ������1λ (�Դ�д��ĸ��ʾ) ��3λ˳���
            string pl = flowDetail.Flow.Code;
            if (pl.Length > 2)
            {
                //��������ߴ��볤�ȴ���2��ȡ����λ
                pl = pl.Substring(pl.Length - 2);
            }

            string pIdMark = idMark != null && idMark.Trim() != string.Empty ? idMark :
                (flowDetail.IdMark != null && flowDetail.IdMark.Trim() != string.Empty
                ? flowDetail.IdMark.Trim() : BusinessConstants.DEFAULT_FINISHI_GOODS_ID_MARK);
            string lotNo = flowDetail.HuLotNo;
            if (lotNo != null && lotNo.Trim().Length != 0)
            {
                LotNoHelper.validateLotNo(lotNo);
            }
            else
            {
                lotNo = LotNoHelper.GenerateLotNo();
            }
            string shift = shiftCode;

            string barCodePrefix = pl + pIdMark + lotNo + shift;
            return GenerateNumber(barCodePrefix, 3);
            #endregion
        }
Exemplo n.º 8
0
 public decimal ConvertUomQtyInvToOrder(FlowDetail flowDetail, decimal invQty)
 {
     return this.ConvertUomQty(flowDetail.Item, flowDetail.Item.Uom, invQty, flowDetail.Uom);
 }
 public OrderDetail TransferFlowDetail2OrderDetail(FlowDetail flowDetail)
 {
     OrderDetail orderDetail = new OrderDetail();
     CloneHelper.CopyProperty(flowDetail, orderDetail, FlowDetail2OrderDetailCloneFields);
     return orderDetail;
 }
Exemplo n.º 10
0
        public IList<OrderDetail> GenerateOrderDetail(OrderHead orderHead, FlowDetail flowDetail, bool isReferencedFlow)
        {
            EntityPreference entityPreference = this.entityPreferenceMgrE.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL);
            int seqInterval = int.Parse(entityPreference.Value);

            IList<OrderDetail> orderDetailList = new List<OrderDetail>();
            OrderDetail orderDetail = new OrderDetail();
            orderDetail.FlowDetail = flowDetail;
            orderDetail.OrderHead = orderHead;
            if (!isReferencedFlow)
            {
                CloneHelper.CopyProperty(flowDetail, orderDetail, FlowDetail2OrderDetailCloneFields);
            }
            else
            {
                CloneHelper.CopyProperty(flowDetail, orderDetail, ReferenceOrderDetailCloneFields);
            }

            #region 查找价格
            if (orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_SUBCONCTRACTING ||
                orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT || orderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
            {
                if (orderDetail.DefaultPriceList != null)
                {
                    PriceListDetail priceListDetail = priceListDetailMgrE.GetLastestPriceListDetail(orderDetail.DefaultPriceList, orderDetail.Item, orderHead.StartTime, orderHead.Currency, orderDetail.Uom);
                    orderDetail.IsProvisionalEstimate = priceListDetail == null ? true : priceListDetail.IsProvisionalEstimate;
                    if (priceListDetail != null)
                    {
                        orderDetail.UnitPrice = priceListDetail.UnitPrice;
                        orderDetail.TaxCode = entityPreferenceMgrE.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_TAX_RATE).Value; //priceListDetail.TaxCode;
                        orderDetail.IsIncludeTax = priceListDetail.IsIncludeTax;
                    }
                }
            }
            #endregion

            #region 设置退货和次品库位
            //if (orderHead.SubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_RTN
            //    || orderHead.SubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_RWO)
            //{
            //    if (flowDetail.LocationFrom != null && flowDetail.LocationFrom.ActingLocation != null)
            //    {
            //        orderDetail.LocationFrom = flowDetail.LocationFrom.ActingLocation;
            //    }

            //    if (flowDetail.LocationTo != null && flowDetail.LocationTo.ActingLocation != null)
            //    {
            //        orderDetail.LocationTo = flowDetail.LocationTo.ActingLocation;
            //    }
            //}
            if (orderHead.SubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_RWO)
            {
                orderDetail.LocationTo = this.locationMgrE.GetRejectLocation();
            }
            #endregion

            //if (orderDetail.Item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_K)
            //{
            //    #region 处理套件
            //    IList<ItemKit> itemKitList = this.itemKitMgrE.GetChildItemKit(orderDetail.Item.Code);

            //    if (itemKitList != null && itemKitList.Count > 0)
            //    {
            //        int count = 0;
            //        decimal? convertRate = null;
            //        foreach (ItemKit itemKit in itemKitList)
            //        {
            //            count++;

            //            if (!convertRate.HasValue)
            //            {
            //                if (itemKit.ParentItem.Uom.Code != orderDetail.Uom.Code)
            //                {
            //                    convertRate = this.uomConversionMgrE.ConvertUomQty(orderDetail.Item, orderDetail.Uom, 1, itemKit.ParentItem.Uom);
            //                }
            //                else
            //                {
            //                    convertRate = 1;
            //                }
            //            }

            //            OrderDetail orderDetailOfChildKit = new OrderDetail();
            //            CloneHelper.CopyProperty(orderDetail, orderDetailOfChildKit, OrderDetailOfChildKitCloneFields);
            //            orderDetailOfChildKit.Sequence = orderDetailOfChildKit.Sequence + count;
            //            orderDetailOfChildKit.Item = itemKit.ChildItem;
            //            orderDetailOfChildKit.ReferenceItemCode = this.itemReferenceMgrE.GetItemReferenceByItem(itemKit.ChildItem.Code, orderDetail.OrderHead.PartyFrom.Code, orderDetail.OrderHead.PartyTo.Code);
            //            orderDetailOfChildKit.Uom = itemKit.ChildItem.Uom;
            //            orderDetailOfChildKit.UnitCount = itemKit.ChildItem.UnitCount;
            //            //orderDetailOfChildKit.RequiredQty = orderDetailOfChildKit.RequiredQty * itemKit.Qty * convertRate;
            //            //orderDetailOfChildKit.OrderedQty = orderDetailOfChildKit.OrderedQty * itemKit.Qty * convertRate;
            //            orderDetailOfChildKit.GoodsReceiptLotSize = orderDetailOfChildKit.GoodsReceiptLotSize * itemKit.Qty * convertRate;
            //            orderDetailOfChildKit.BatchSize = orderDetailOfChildKit.BatchSize * itemKit.Qty * convertRate;
            //            if (orderDetailOfChildKit.HuLotSize.HasValue)
            //            {
            //                orderDetailOfChildKit.HuLotSize = int.Parse((orderDetailOfChildKit.HuLotSize.Value * itemKit.Qty * convertRate.Value).ToString("#"));
            //            }

            //            #region 计算价格
            //            if (orderDetailOfChildKit.DefaultPriceListFrom != null)
            //            {
            //                PriceListDetail priceListDetailFrom = priceListDetailMgrE.GetLastestPriceListDetail(orderDetailOfChildKit.DefaultPriceListFrom, orderDetailOfChildKit.Item, orderHead.StartTime, orderHead.Currency, orderDetailOfChildKit.Uom);
            //                if (priceListDetailFrom != null)
            //                {
            //                    orderDetailOfChildKit.PriceListDetailFrom = priceListDetailFrom;
            //                }
            //            }
            //            if (orderDetailOfChildKit.DefaultPriceList != null)
            //            {
            //                    PriceListDetail priceListDetail = priceListDetailMgrE.GetLastestPriceListDetail(orderDetailOfChildKit.DefaultPriceList, orderDetailOfChildKit.Item, orderHead.StartTime, orderHead.Currency, orderDetailOfChildKit.Uom);
            //                    orderDetailOfChildKit.IsProvisionalEstimate = priceListDetail == null ? true : priceListDetail.IsProvisionalEstimate;
            //                if (priceListDetailTo != null)
            //                {
            //                    orderDetailOfChildKit.UnitPrice = priceListDetail.UnitPrice;
            //                         orderDetailOfChildKit.IsIncludeTax = priceListDetail.IsIncludeTax;
            //                        orderDetailOfChildKit.TaxCode = entityPreferenceMgrE.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_TAX_RATE).Value;//priceListDetail.TaxCode;
            //                }
            //            }
            //            #endregion

            //            //重新设置Sequence
            //            int detailCount = orderHead.OrderDetails != null ? orderHead.OrderDetails.Count : 0;
            //            orderDetail.Sequence = (detailCount + 1) * seqInterval;

            //            orderHead.AddOrderDetail(orderDetailOfChildKit);
            //            orderDetailList.Add(orderDetailOfChildKit);
            //        }
            //    }
            //    else
            //    {
            //        throw new BusinessErrorException("ItemKit.Error.NotFoundForParentItem", orderDetail.Item.Code);
            //    }
            //    #endregion
            //}
            //else
            //{
            //重新设置Sequence
            int detailCount = orderHead.OrderDetails != null ? orderHead.OrderDetails.Count : 0;
            orderDetail.Sequence = (detailCount + 1) * seqInterval;

            #region 参考零件号
            if (orderDetail.ReferenceItemCode == null || orderDetail.ReferenceItemCode == string.Empty)
            {
                string firstPartyCode = string.Empty;
                string secondPartyCode = string.Empty;
                if (orderHead.Type == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_DISTRIBUTION)
                {
                    firstPartyCode = orderHead.PartyTo.Code;
                }
                else
                {
                    firstPartyCode = orderHead.PartyFrom.Code;
                }
                orderDetail.ReferenceItemCode = itemReferenceMgrE.GetItemReferenceByItem(orderDetail.Item.Code, firstPartyCode, secondPartyCode);
            }
            #endregion

            #region 设置默认库位
            orderDetail.LocationFrom = orderDetail.LocationFrom == null ? orderHead.LocationFrom : orderDetail.LocationFrom;
            orderDetail.LocationTo = orderDetail.LocationTo == null ? orderHead.LocationTo : orderDetail.LocationTo;
            #endregion

            orderHead.AddOrderDetail(orderDetail);
            orderDetailList.Add(orderDetail);
            //}

            return orderDetailList;
        }
Exemplo n.º 11
0
 public SupplyChain GenerateSupplyChain(FlowDetail flowDetail)
 {
     return this.GenerateSupplyChain(flowDetail.Flow, flowDetail);
 }
Exemplo n.º 12
0
        private string GetBomCode(FlowDetail flowDetail)
        {
            string bomCode = string.Empty;
            if (flowDetail.Bom != null)
            {
                bomCode = flowDetail.Bom.Code;
            }
            else
            {
                bomCode = flowDetail.Item.Bom == null ? flowDetail.Item.Code : flowDetail.Item.Bom.Code;
            }

            return bomCode;
        }
Exemplo n.º 13
0
        public string GenerateRMHuId(FlowDetail flowDetail, string lotNo, decimal qty, string idMark)
        {
            #region ��������
            //if (flowDetail.BarCodeType == BusinessConstants.CODE_MASTER_RAW_MATERIAL_BAR_CODE_TYPE_VALUE_DEFAULT)
            //{

            //}
            //else
            //{

            //}
            //ItemCode����Ӧ�̱�ʶ��1λ������ �� ��4λ + ������4λ������4λ��0���룩��������ţ�3λ������3λ��0���룩
            string itemCode = flowDetail.Item.Code;
            string supIdMark = idMark != null && idMark.Trim() != string.Empty ? idMark :
                (flowDetail.IdMark != null && flowDetail.IdMark.Trim() != string.Empty
                ? flowDetail.IdMark.Trim() : BusinessConstants.DEFAULT_SUPPLIER_ID_MARK);
            if (lotNo != null && lotNo.Trim().Length != 0)
            {
                LotNoHelper.validateLotNo(lotNo);
            }
            else
            {
                lotNo = LotNoHelper.GenerateLotNo();
            }
            if (flowDetail.Item.Uom.Code != flowDetail.Uom.Code)
            {
                qty = qty * this.uomConversionMgr.ConvertUomQty(flowDetail.Item, flowDetail.Uom, 1, flowDetail.Item.Uom);   //�����
            }
            string qtyStr = qty.ToString().PadLeft(4, '0');

            string barCodePrefix = itemCode + supIdMark + lotNo + qtyStr;
            return GenerateNumber(barCodePrefix, 3);
            #endregion
        }
Exemplo n.º 14
0
    public void InitPageParameter(Flow flow)
    {
        this.PartyFromCode = flow.PartyFrom.Code;
        this.PartyToCode = flow.PartyTo.Code;
        this.FlowType = flow.Type;
        this.FlowCode = flow.Code;

        int seqInterval = int.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL).Value);

        if (flow.AllowCreateDetail && false) //新增的Detail打印有问题,暂时不支持
        {
            FlowDetail blankFlowDetail = new FlowDetail();
            if (flow.FlowDetails == null || flow.FlowDetails.Count == 0)
            {
                blankFlowDetail.Sequence = seqInterval;
            }
            else
            {
                int CurrentSeq = flow.FlowDetails.Last<FlowDetail>().Sequence + seqInterval;
                blankFlowDetail.Sequence = CurrentSeq;
            }
            blankFlowDetail.IsBlankDetail = true;
            flow.AddFlowDetail(blankFlowDetail);
        }

        #region 设置默认LotNo
        string lotNo = LotNoHelper.GenerateLotNo();
        foreach (FlowDetail flowDetail in flow.FlowDetails)
        {
            flowDetail.HuLotNo = lotNo;
        }
        #endregion

        this.GV_List.DataSource = flow.FlowDetails;
        this.GV_List.DataBind();

        BindShift();

        if (flow.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)
        {
            this.TabProd.Visible = false;
            this.GV_List.Columns[8].Visible = true;
        }
        else
        {
            this.TabProd.Visible = true;
            this.GV_List.Columns[8].Visible = false;
        }
    }
Exemplo n.º 15
0
    //返回订单明细
    private IList<FlowDetail> PopulateFlowDetailList(bool includeBlank)
    {
        if (this.GV_List.Rows != null && this.GV_List.Rows.Count > 0)
        {
            Flow flow = null;
            DateTime? winTime = null;
            IList<FlowDetail> flowDetailList = new List<FlowDetail>();
            if (this.tbWinTime.Text.Trim() != string.Empty)
            {
                winTime = DateTime.Parse(this.tbWinTime.Text.Trim());
            }

            int seqInterval = int.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL).Value);
            int lastSeq = 0;

            foreach (GridViewRow row in this.GV_List.Rows)
            {
                HiddenField hfId = (HiddenField)row.FindControl("hfId");
                TextBox tbLotNo = (TextBox)row.FindControl("tbLotNo");
                TextBox tbOrderQty = (TextBox)row.FindControl("tbOrderQty");

                if (hfId.Value != string.Empty && hfId.Value != "0")
                {
                    FlowDetail flowDetail = TheFlowDetailMgr.LoadFlowDetail(int.Parse(hfId.Value));
                    flowDetail.HuLotNo = tbLotNo.Text.Trim() != string.Empty ? tbLotNo.Text.Trim() : null;
                    flowDetail.OrderedQty = tbOrderQty.Text != string.Empty ? decimal.Parse(tbOrderQty.Text) : decimal.Zero;
                    flowDetailList.Add(flowDetail);
                    lastSeq = flowDetail.Sequence;
                    if (flow == null)
                    {
                        flow = flowDetail.Flow;
                    }

                    if (flow.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)
                    {
                        flowDetail.HuLotNo = tbLotNo.Text.Trim() != string.Empty ? tbLotNo.Text.Trim() : null;
                    }
                    else
                    {
                        flowDetail.HuLotNo = LotNoHelper.GenerateLotNo(winTime.Value);
                        flowDetail.HuShiftCode = this.ucShift.ShiftCode;
                    }
                }
                else
                {
                    if (!includeBlank)
                    {
                        continue;
                    }

                    if (flow == null)
                    {
                        flow = this.TheFlowMgr.LoadFlow(this.FlowCode);
                    }

                    TextBox tbNewSeq = (TextBox)row.FindControl("tbSeq");
                    Controls_TextBox tbNewItemCode = (Controls_TextBox)row.FindControl("tbItemCode");
                    Controls_TextBox tbNewUom = (Controls_TextBox)row.FindControl("tbUom");
                    com.Sconit.Control.CodeMstrDropDownList ddlPackageType = (com.Sconit.Control.CodeMstrDropDownList)row.FindControl("ddlPackageType");
                    TextBox tbNewUnitCount = (TextBox)row.FindControl("tbUnitCount");
                    TextBox tbNewOrderQty = (TextBox)row.FindControl("tbOrderQty");

                    FlowDetail newFlowDetail = new FlowDetail();
                    newFlowDetail.Sequence = tbNewSeq.Text != string.Empty ? int.Parse(tbNewSeq.Text) : (lastSeq + seqInterval);
                    newFlowDetail.Item = this.TheItemMgr.LoadItem(tbNewItemCode.Text.Trim());
                    newFlowDetail.Uom = this.TheUomMgr.LoadUom(tbNewUom.Text.Trim());
                    newFlowDetail.PackageType = ddlPackageType.SelectedValue;
                    newFlowDetail.UnitCount = tbNewUnitCount.Text.Trim() != string.Empty ? decimal.Parse(tbNewUnitCount.Text) : 1;
                    newFlowDetail.OrderedQty = tbNewOrderQty.Text.Trim() == string.Empty ? 0 : decimal.Parse(tbNewOrderQty.Text.Trim());
                    newFlowDetail.Flow = flow;
                    newFlowDetail.IsBlankDetail = true;

                    if (flow.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)
                    {
                        newFlowDetail.HuLotNo = tbLotNo.Text.Trim() != string.Empty ? tbLotNo.Text.Trim() : null;
                    }
                    else
                    {
                        newFlowDetail.HuLotNo = LotNoHelper.GenerateLotNo(winTime.Value);
                        newFlowDetail.HuShiftCode = this.ucShift.ShiftCode;
                    }

                    flowDetailList.Add(newFlowDetail);
                }

            }

            return flowDetailList;
        }

        return null;
    }
Exemplo n.º 16
0
    protected void lbtnAdd_Click(object sender, EventArgs e)
    {
        IList<FlowDetail> flowDetailList = PopulateFlowDetailList(true);

        if (CheckItemExists(flowDetailList))
        {
            return;
        }

        int newRowId = flowDetailList != null ? flowDetailList.Count - 1 : 0;
        GridViewRow newRow = this.GV_List.Rows[newRowId];
        RequiredFieldValidator rfvItemCode = (RequiredFieldValidator)newRow.FindControl("rfvItemCode");
        RequiredFieldValidator rfvUom = (RequiredFieldValidator)newRow.FindControl("rfvUom");
        int seqInterval = int.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL).Value);

        if (rfvItemCode.IsValid && rfvUom.IsValid)
        {
            if (flowDetailList != null)
            {
                Flow flow = flowDetailList[0].Flow;
                FlowDetail flowDetail = flowDetailList.Last<FlowDetail>();
                flowDetailList.RemoveAt(newRowId);

                if (flowDetail.Item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_K)
                {
                    IList<ItemKit> itemKitList = this.TheItemKitMgr.GetChildItemKit(flowDetail.Item);
                    decimal? convertRate = null;

                    foreach (ItemKit itemKit in itemKitList)
                    {
                        if (!convertRate.HasValue)
                        {
                            if (itemKit.ParentItem.Uom.Code != flowDetail.Uom.Code)
                            {
                                convertRate = this.TheUomConversionMgr.ConvertUomQty(flowDetail.Item, flowDetail.Uom, 1, itemKit.ParentItem.Uom);
                            }
                            else
                            {
                                convertRate = 1;
                            }
                        }

                        FlowDetail newKitFlowDetail = new FlowDetail();

                        newKitFlowDetail.Sequence = flowDetailList.Last<FlowDetail>().Sequence + seqInterval;
                        newKitFlowDetail.Item = itemKit.ChildItem;
                        newKitFlowDetail.Uom = itemKit.ChildItem.Uom;
                        newKitFlowDetail.UnitCount = flowDetail.UnitCount * itemKit.Qty * convertRate.Value;
                        newKitFlowDetail.OrderedQty = flowDetail.OrderedQty * itemKit.Qty * convertRate.Value;
                        newKitFlowDetail.PackageType = flowDetail.PackageType;
                        newKitFlowDetail.IsBlankDetail = false;
                        newKitFlowDetail.Flow = flow;

                        flowDetailList.Add(newKitFlowDetail);
                    }
                }
                else
                {
                    flowDetail.IsBlankDetail = false;
                    flowDetailList.Add(flowDetail);
                }

                FlowDetail blankFlowDetail = new FlowDetail();
                blankFlowDetail.Sequence = flowDetailList.Last<FlowDetail>().Sequence + seqInterval;
                blankFlowDetail.IsBlankDetail = true;
                blankFlowDetail.HuLotNo = LotNoHelper.GenerateLotNo();
                flowDetailList.Add(blankFlowDetail);

                this.GV_List.DataSource = flowDetailList;
                this.GV_List.DataBind();
            }
        }
    }
Exemplo n.º 17
0
 public virtual void UpdateFlowDetail(FlowDetail entity)
 {
     entityDao.UpdateFlowDetail(entity);
 }
Exemplo n.º 18
0
 public virtual void DeleteFlowDetail(FlowDetail entity)
 {
     entityDao.DeleteFlowDetail(entity);
 }
Exemplo n.º 19
0
 public virtual void CreateFlowDetail(FlowDetail entity)
 {
     entityDao.CreateFlowDetail(entity);
 }
Exemplo n.º 20
0
    protected void ODS_FlowDetail_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
    {
        flowDetail = (FlowDetail)e.InputParameters[0];
        Flow flow = TheFlowMgr.LoadFlow(FlowCode, true);

        flowDetail.Flow = flow;

        //seq
        if (flowDetail.Sequence == 0)
        {
            int seqInterval = int.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL).Value);
            flowDetail.Sequence = seqInterval + FlowHelper.GetMaxFlowSeq(flow);
        }
        Controls_TextBox tbItemCode = (Controls_TextBox)(this.FV_FlowDetail.FindControl("tbItemCode"));
        Controls_TextBox tbUom = (Controls_TextBox)(this.FV_FlowDetail.FindControl("tbUom"));
        if (tbItemCode != null && tbItemCode.Text.Trim() != string.Empty)
        {
            flowDetail.Item = TheItemMgr.LoadItem(tbItemCode.Text.Trim());

            TextBox tbBrand = (TextBox)(this.FV_FlowDetail.FindControl("tbBrand"));
            if (tbBrand.Text.Trim() == string.Empty)
            {
                flowDetail.Brand = flowDetail.Item.Brand;
            }
            TextBox tbManufacturer = (TextBox)(this.FV_FlowDetail.FindControl("tbManufacturer"));
            if (tbManufacturer.Text.Trim() == string.Empty)
            {
                flowDetail.Manufacturer = flowDetail.Item.Manufacturer;
            }
        }

        if (tbUom != null && tbUom.Text.Trim() != string.Empty)
        {
            flowDetail.Uom = TheUomMgr.LoadUom(tbUom.Text.Trim());
        }

        com.Sconit.Control.CodeMstrDropDownList ddlRoundUpOpt = (com.Sconit.Control.CodeMstrDropDownList)this.FV_FlowDetail.FindControl("ddlRoundUpOpt");
        if (ddlRoundUpOpt.SelectedIndex != -1)
        {
            flowDetail.RoundUpOption = ddlRoundUpOpt.SelectedValue;
        }

        if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PROCUREMENT
            || this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_CUSTOMERGOODS
            || this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_SUBCONCTRACTING)
        {
            Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbProcurementLocTo");
            if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty)
            {
                flowDetail.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim());
            }
            if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PROCUREMENT
                || this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_SUBCONCTRACTING)
            {

                com.Sconit.Control.CodeMstrDropDownList ddlBarCodeType = (com.Sconit.Control.CodeMstrDropDownList)this.FV_FlowDetail.FindControl("ddlBarCodeType");
                if (ddlBarCodeType.SelectedIndex != -1)
                {
                    flowDetail.BarCodeType = ddlBarCodeType.SelectedValue;
                }

            }
        }
        else if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_DISTRIBUTION)
        {

            DropDownList ddlOddShipOption = (DropDownList)this.FV_FlowDetail.FindControl("ddlOddShipOption");
            if (ddlOddShipOption.SelectedIndex != -1)
            {

                flowDetail.OddShipOption = ddlOddShipOption.SelectedValue;

            }
            Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbDistributionLocFrom");
            if (tbLocFrom != null && tbLocFrom.Text.Trim() != string.Empty)
            {
                flowDetail.LocationFrom = TheLocationMgr.LoadLocation(tbLocFrom.Text.Trim());
            }
        }
        else if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PRODUCTION)
        {
            Controls_TextBox tbBom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbBom");
            if (tbBom != null && tbBom.Text.Trim() != string.Empty)
            {
                flowDetail.Bom = TheBomMgr.LoadBom(tbBom.Text.Trim());
            }

            TextBox tbBatchSize = (TextBox)this.FV_FlowDetail.FindControl("tbBatchSize");
            Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbProductionLocFrom");
            if (tbBatchSize.Text.Trim() != string.Empty)
            {
                flowDetail.BatchSize = decimal.Parse(tbBatchSize.Text.Trim());
            }
            if (tbLocFrom != null && tbLocFrom.Text.Trim() != string.Empty)
            {
                flowDetail.LocationFrom = TheLocationMgr.LoadLocation(tbLocFrom.Text.Trim());
            }
            Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbProductionLocTo");
            if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty)
            {
                flowDetail.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim());
            }

            com.Sconit.Control.CodeMstrDropDownList ddlBarCodeType = (com.Sconit.Control.CodeMstrDropDownList)this.FV_FlowDetail.FindControl("ddlBarCodeType");
            if (ddlBarCodeType.SelectedIndex != -1)
            {
                flowDetail.BarCodeType = ddlBarCodeType.SelectedValue;
            }
        }
        else if (this.ModuleType == BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_TRANSFER)
        {
            DropDownList ddlOddShipOption = (DropDownList)this.FV_FlowDetail.FindControl("ddlOddShipOption");
            if (ddlOddShipOption.SelectedIndex != -1)
            {
                flowDetail.OddShipOption = ddlOddShipOption.SelectedValue;
            }
            Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbTransferLocFrom");
            if (tbLocFrom != null && tbLocFrom.Text.Trim() != string.Empty)
            {
                flowDetail.LocationFrom = TheLocationMgr.LoadLocation(tbLocFrom.Text.Trim());
            }
            Controls_TextBox tbLocTo = (Controls_TextBox)this.FV_FlowDetail.FindControl("tbTransferLocTo");
            if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty)
            {
                flowDetail.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim());
            }
        }
    }
Exemplo n.º 21
0
 public override void DeleteFlowDetail(FlowDetail entity)
 {
     flowDetailTrackMgr.CreateFlowDetailTrack(entity, BusinessConstants.TRACK_EVENT_DELETE);
     base.DeleteFlowDetail(entity);
 }
Exemplo n.º 22
0
 public string GenerateRMHuId(FlowDetail flowDetail, string lotNo, decimal qty)
 {
     return GenerateRMHuId(flowDetail, lotNo, qty, null);
 }
        private decimal GetFinalPlanQty(decimal planQty, FlowDetail flowDetail)
        {
            decimal finalPlanQty = planQty;

            //批量
            decimal batchSize = flowDetail.BatchSize == null ? 0 : (decimal)(flowDetail.BatchSize);
            if (batchSize > 0)
            {
                finalPlanQty = Math.Ceiling(planQty / batchSize) * batchSize;
            }

            return finalPlanQty;
        }
Exemplo n.º 24
0
 public string GenerateFGHuId(FlowDetail flowDetail, string shiftCode, decimal qty)
 {
     return GenerateFGHuId(flowDetail, shiftCode, qty, null);
 }
Exemplo n.º 25
0
 public override void DeleteFlowDetail(FlowDetail entity)
 {
     base.DeleteFlowDetail(entity);
 }
 public void GeneratePlanning(Flow flow, FlowDetail flowDetail)
 {
 }
Exemplo n.º 27
0
 public IList<OrderDetail> GenerateOrderDetail(OrderHead orderHead, FlowDetail flowDetail)
 {
     return GenerateOrderDetail(orderHead, flowDetail, false);
 }
Exemplo n.º 28
0
 public void UpdateFlowDetail(FlowDetail itemFlowDetail)
 {
     FlowDetailMgr.UpdateFlowDetail(itemFlowDetail);
 }
Exemplo n.º 29
0
        public IList<Flow> GetReferenceFlow(FlowDetail flowDetail, string locTo)
        {
            IList<Flow> refFlowList = new List<Flow>();
            DetachedCriteria criteria = DetachedCriteria.For(typeof(Flow));
            criteria.Add(Expression.IsNotNull("ReferenceFlow"));
            IList<Flow> flowList = CriteriaMgrE.FindAll<Flow>(criteria);
            if (flowList != null && flowList.Count > 0)
            {
                foreach (Flow flow in flowList)
                {
                    if (flow.LocationTo != null)
                    {
                        if (flow.LocationTo.Code == locTo && flowDetail.Flow.Code == flow.ReferenceFlow)
                        {
                            refFlowList.Add(flow);
                            break;
                        }
                    }
                }
            }

            return refFlowList;
        }
Exemplo n.º 30
0
        public FlowView CheckAndLoadFlowView(string flowCode, string userCode, string locationFromCode, string locationToCode, Hu hu, List<string> flowTypes)
        {

            //按物料号,单位,单包装
            FlowView flowView = LoadFlowView(flowCode, userCode, locationFromCode, locationToCode, hu, flowTypes);

            //看是否允许新建明细
            if (flowView == null)
            {
                IList<Flow> flowList = this.GetFlows(flowCode, locationFromCode, locationToCode, true, userCode, flowTypes);
                if (flowList != null && flowList.Count > 0)
                {
                    flowView = new FlowView();
                    flowView.Flow = flowList[0];
                    FlowDetail flowDetail = new FlowDetail();
                    flowDetail.Item = hu.Item;
                    flowDetail.Uom = hu.Uom;
                    flowDetail.UnitCount = hu.UnitCount;
                    flowView.LocationFrom = flowView.Flow.LocationFrom;
                    flowView.LocationTo = flowView.Flow.LocationTo;
                }
            }
            if (flowView != null)
            {
                return flowView;
            }
            else
            {
                throw new BusinessErrorException("Flow.Error.NotFoundMacthFlow", hu.HuId, flowCode);
            }
        }
Exemplo n.º 31
0
 public override void CreateFlowDetail(FlowDetail entity)
 {
     base.CreateFlowDetail(entity);
     Flow flow = entity.Flow;
     flow.LastModifyDate = DateTime.Now;
     flowDao.UpdateFlow(flow);
 }