示例#1
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string flowCode = this.tbFlow.Text.Trim();

        if (flowCode == string.Empty)
        {
            ShowErrorMessage("Common.Business.Error.Require.Flow");
            return;
        }
        Flow flow = TheFlowMgr.LoadFlow(flowCode);

        if (flow.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
        {
            this.PartyCode = flow.PartyTo.Code;
        }
        else
        {
            this.PartyCode = flow.PartyFrom.Code;
        }
        IList <CustomerScheduleDetail> customerScheduleDetails = TheCustomerScheduleDetailMgr.GetCustomerScheduleDetails(flowCode, this.StartDate);
        ScheduleView scheduleView = TheCustomerScheduleDetailMgr.TransferCustomerScheduleDetails2ScheduleView(customerScheduleDetails, this.StartDate);

        itemRefs = TheItemReferenceMgr.GetAllItemReference();

        this.GV_List_DataBind(scheduleView);
    }
 protected void FV_Routing_DataBound(object sender, EventArgs e)
 {
     if (FlowCode != null && FlowCode != string.Empty)
     {
         Flow    flow         = TheFlowMgr.LoadFlow(FlowCode);
         Literal lblRouting   = (Literal)this.FV_Routing.FindControl("lblRouting");
         Literal lRouting     = (Literal)(this.FV_Routing.FindControl("lRouting"));
         Literal lDescription = (Literal)(this.FV_Routing.FindControl("lDescription"));
         lblRouting.Text = FlowHelper.GetFlowRoutingLabel(this.ModuleType);
         if (!IsReturn)
         {
             if (flow.Routing != null)
             {
                 lRouting.Text     = flow.Routing.Code;
                 lDescription.Text = flow.Routing.Description;
                 EditEvent(DoSearch(flow.Routing.Code, IsReturn), null);
             }
         }
         else
         {
             if (flow.ReturnRouting != null)
             {
                 lblRouting.Text   = "${MasterData.Flow.ReturnRouting}";
                 lRouting.Text     = flow.ReturnRouting.Code;
                 lDescription.Text = flow.ReturnRouting.Description;
                 EditEvent(DoSearch(flow.ReturnRouting.Code, IsReturn), null);
             }
         }
     }
 }
示例#3
0
    public void ShowTreeView(object sender)
    {
        string flowCode = ((object[])sender)[0].ToString();
        string itemCode = ((object[])sender)[1].ToString();

        if (TheFlowMgr.LoadFlow(flowCode) == null)
        {
            ShowErrorMessage("Common.Business.Warn.FlowInvalid");
            return;
        }
        if (TheItemMgr.LoadItem(itemCode) == null)
        {
            ShowErrorMessage("Common.Business.Warn.ItemInvalid");
            return;
        }

        supplyChain           = TheSupplyChainMgr.GenerateSupplyChain(flowCode, itemCode)[0];
        supplyChainDetailList = supplyChain.SupplyChainDetails;

        if (supplyChainDetailList != null && supplyChainDetailList.Count > 0)
        {
            MyOrgNode RootNode = new MyOrgNode();
            GenChildOrgNode(RootNode);
            OrgChartTreeView.Node = RootNode;
        }
    }
示例#4
0
    protected void tbFlow_TextChanged(Object sender, EventArgs e)
    {
        try
        {
            if (this.CurrentFlowCode == null || this.CurrentFlowCode != this.tbFlow.Text)
            {
                Flow currentFlow = TheFlowMgr.LoadFlow(tbFlow.Text, this.CurrentUser.Code, true, this.ModuleType);
                if (currentFlow != null)
                {
                    this.CurrentFlowCode      = currentFlow.Code;
                    this.cbPrintOrder.Checked = currentFlow.NeedPrintOrder;
                    OrderHead orderHead = TheOrderMgr.TransferFlow2Order(currentFlow);
                    orderHead.SubType    = this.ModuleSubType;
                    orderHead.WindowTime = DateTime.Now;

                    InitDetailParamater(orderHead);
                }
                else
                {
                    this.tbFlow.Text    = string.Empty;
                    this.ucList.Visible = false;
                }
            }
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
示例#5
0
    public void InitPageParameter(string flowCode)
    {
        this.FlowCode = flowCode;
        this.ucFlow.InitPageParameter(flowCode);
        this.ucStrategy.InitPageParameter(flowCode);
        IDictionary <string, string> mpDic = new Dictionary <string, string>();

        mpDic.Add("FlowCode", this.FlowCode);
        Flow currentFlow = TheFlowMgr.LoadFlow(flowCode, true, true);

        if (currentFlow.FlowDetails.Count > 0)
        {
            this.fdDetail.Visible = true;
            this.ucDetailSearch.QuickSearch(mpDic);
        }
        if (currentFlow.Routing != null)
        {
            this.fdRouting.Visible = true;
            this.ucRouting.InitPageParameter(flowCode, false);
        }
        this.ucLocTrans.FlowCode = flowCode;
        this.ucLocTrans.InitPageParameter();

        this.ucActingBill.FlowCode  = flowCode;
        this.ucActingBill.OrderType = BusinessConstants.BILL_TRANS_TYPE_SO;
        this.ucActingBill.InitPageParameter();
    }
示例#6
0
    protected void tbFlow_TextChanged(Object sender, EventArgs e)
    {
        try
        {
            if (this.CurrentFlowCode == null || this.CurrentFlowCode != this.tbFlow.Text)
            {
                Flow currentFlow = TheFlowMgr.LoadFlow(this.tbFlow.Text);
                if (currentFlow != null)
                {
                    this.CurrentFlowCode = currentFlow.Code;

                    if (currentFlow.IsListDetail)
                    {
                        currentFlow.FlowDetails = TheFlowDetailMgr.GetFlowDetail(currentFlow);
                    }
                    else
                    {
                        currentFlow.FlowDetails = new List <FlowDetail>();
                    }

                    this.ucList.InitPageParameter(currentFlow);
                    this.ucList.Visible = true;
                }
            }
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
示例#7
0
    public void InitPageParameter(string flowCode)
    {
        this.FlowCode = flowCode;
        this.ucFlow.InitPageParameter(flowCode);
        this.ucStrategy.InitPageParameter(flowCode);
        IDictionary <string, string> mpDic = new Dictionary <string, string>();

        mpDic.Add("FlowCode", this.FlowCode);
        Flow currentFlow = TheFlowMgr.LoadFlow(flowCode, true, true);

        if (currentFlow.FlowDetails.Count > 0)
        {
            this.fdDetail.Visible = true;
            this.ucDetailSearch.QuickSearch(mpDic);
        }
        if (currentFlow == null && currentFlow.ReturnRouting == null)
        {
            this.fdProductionRouting.Visible = false;
        }
        else
        {
            if (currentFlow.Routing != null)
            {
                this.fdRouting.Visible = true;
                this.ucRouting.InitPageParameter(flowCode, false);
            }
            if (currentFlow.ReturnRouting != null)
            {
                this.fdReturn.Visible = true;
                this.ucReturnRouting.InitPageParameter(flowCode, true);
            }
        }
        this.ucLocTrans.FlowCode = flowCode;
        this.ucLocTrans.InitPageParameter();
    }
示例#8
0
    private void BindShift()
    {
        Flow     currentFlow = TheFlowMgr.LoadFlow(tbFlow.Text, true);
        string   regionCode  = currentFlow != null ?currentFlow.PartyFrom.Code:string.Empty;
        DateTime dateTime    = this.tbStartTime.Text.Trim() == string.Empty ? DateTime.Today : DateTime.Parse(this.tbStartTime.Text);

        this.ucShift.BindList(dateTime, regionCode);
    }
示例#9
0
 protected void tbWinTime_TextChanged(object sender, EventArgs e)
 {
     if (this.FlowType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)
     {
         Flow currentFlow = TheFlowMgr.LoadFlow(this.FlowCode, false);
         this.BindShift(currentFlow);
     }
 }
示例#10
0
    protected void checkFlowExists(object source, ServerValidateEventArgs args)
    {
        String flowCode = ((TextBox)(this.FV_Flow.FindControl("tbCode"))).Text;

        if (TheFlowMgr.LoadFlow(flowCode) != null)
        {
            args.IsValid = false;
        }
    }
示例#11
0
    protected void ODS_Shelf_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
    {
        Controls_TextBox tbProductLine = (Controls_TextBox)this.FV_Shelf.FindControl("tbProductLine");
        TextBox          tbCapacity    = (TextBox)this.FV_Shelf.FindControl("tbCapacity");

        shelf             = (Shelf)e.InputParameters[0];
        shelf.Code        = shelf.Code.Trim();
        shelf.ProductLine = TheFlowMgr.LoadFlow(tbProductLine.Text.Trim());
        shelf.TagNo       = shelf.TagNo.Trim();
    }
示例#12
0
    protected void CheckAllItem(object source, ServerValidateEventArgs args)
    {
        Controls_TextBox tbLocFrom         = (Controls_TextBox)this.FV_Flow.FindControl("tbLocFrom");
        Controls_TextBox tbLocTo           = (Controls_TextBox)this.FV_Flow.FindControl("tbLocTo");
        Controls_TextBox tbRefFlow         = (Controls_TextBox)this.FV_Flow.FindControl("tbRefFlow");
        CustomValidator  cvCheckDetailItem = (CustomValidator)this.FV_Flow.FindControl("cvCheckDetailItem");

        if (tbRefFlow != null && tbRefFlow.Text.Trim() != string.Empty)
        {
            Flow flow = TheFlowMgr.LoadFlow(FlowCode);

            List <FlowDetail> flowDetailList    = (List <FlowDetail>)TheFlowDetailMgr.GetFlowDetail(flow);
            List <FlowDetail> refFlowDetailList = (List <FlowDetail>)TheFlowDetailMgr.GetFlowDetail(tbRefFlow.Text.Trim());
            if (!FlowHelper.CheckDetailSeqExists(flowDetailList, refFlowDetailList))
            {
                args.IsValid = false;
                ShowErrorMessage("MasterData.Flow.RefFlow.Sequence.Exists");
                return;
            }
            ;


            List <string[]> itemList = new List <string[]>();
            foreach (FlowDetail flowDetail in flowDetailList)
            {
                string[] item = new string[5];
                item[0] = flowDetail.Item.Code;
                item[1] = flowDetail.Uom.Code;
                item[2] = flowDetail.DefaultLocationFrom != null ? flowDetail.DefaultLocationFrom.Code : string.Empty;
                item[3] = flowDetail.DefaultLocationTo != null ? flowDetail.DefaultLocationTo.Code : string.Empty;
                item[4] = flowDetail.UnitCount.ToString();
                itemList.Add(item);
            }

            foreach (FlowDetail refFlowDetail in refFlowDetailList)
            {
                string[] item = new string[5];
                item[0] = refFlowDetail.Item.Code;
                item[1] = refFlowDetail.Uom.Code;
                item[2] = refFlowDetail.LocationFrom != null ? refFlowDetail.LocationFrom.Code : tbLocFrom.Text.Trim();
                item[3] = refFlowDetail.LocationTo != null ? refFlowDetail.LocationTo.Code : tbLocTo.Text.Trim();
                item[4] = refFlowDetail.UnitCount.ToString();
                if (!FlowHelper.CheckDetailItemExists(itemList, item))
                {
                    args.IsValid = false;
                    ShowErrorMessage("MasterData.Flow.FlowDetail.Item.Code.Exists", item[0]);
                }
                else
                {
                    itemList.Add(item);
                }
            }
        }
    }
示例#13
0
    protected void GV_List_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        //添加
        if (e.CommandName.Equals("AddBinding"))
        {
            int         index = int.Parse(e.CommandArgument.ToString());
            GridViewRow row   = this.GV_List.Rows[index];

            string flowCode = ((Controls_TextBox)row.FindControl("tbFlow")).Text.Trim();
            if (flowCode == string.Empty)
            {
                ShowErrorMessage("MasterData.Order.Binding.Flow.Empty");
                return;
            }
            string bindingType = ((DropDownList)row.FindControl("ddlBindingType")).SelectedValue;
            string remark      = ((TextBox)row.FindControl("tbRemark")).Text.Trim();

            #region 检查是否存在
            OrderHead orderHead = TheOrderHeadMgr.LoadOrderHead(this.OrderNo);
            if (orderHead.Flow == flowCode)
            {
                ShowErrorMessage("MasterData.Order.Binding.Self");
                return;
            }
            for (int i = 0; i < index; i++)
            {
                GridViewRow oneRow      = this.GV_List.Rows[i];
                string      oneFlowCode = ((Label)oneRow.FindControl("lbFlow")).Text.Trim();
                if (flowCode == oneFlowCode)
                {
                    ShowErrorMessage("MasterData.Order.Binding.Flow.Exists");
                    return;
                }
            }
            #endregion

            OrderBinding orderBinding = new OrderBinding();
            orderBinding.OrderHead   = orderHead;
            orderBinding.BindedFlow  = TheFlowMgr.LoadFlow(flowCode);
            orderBinding.BindingType = bindingType;
            orderBinding.Remark      = remark;
            TheOrderBindingMgr.CreateOrderBinding(orderBinding);
            ShowSuccessMessage("MasterData.Order.Binding.Add.Successfully");
            UpdateView();
        }
        else if (e.CommandName.Equals("DeleteBinding"))
        {
            int id = int.Parse(e.CommandArgument.ToString());
            TheOrderBindingMgr.DeleteOrderBinding(id);
            ShowSuccessMessage("MasterData.Order.Binding.Delete.Successfully");
            UpdateView();
        }
    }
示例#14
0
    protected void ODS_Shelf_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        Shelf            oldShelef     = TheShelfMgr.LoadShelf(this.Code);
        Shelf            shelf         = (Shelf)e.InputParameters[0];
        Controls_TextBox tbProductLine = (Controls_TextBox)this.FV_Shelf.FindControl("tbProductLine");

        shelf.ProductLine      = TheFlowMgr.LoadFlow(tbProductLine.Text.Trim());
        shelf.Capacity         = oldShelef.Capacity;
        shelf.CurrentCartons   = oldShelef.CurrentCartons;
        shelf.OriginalCartonNo = oldShelef.OriginalCartonNo;
        shelf.Code             = oldShelef.Code;
    }
示例#15
0
 protected void tbFlow_Changed(object sender, EventArgs e)
 {
     if (tbFlow.Text.Trim() != string.Empty)
     {
         Flow flow = TheFlowMgr.LoadFlow(tbFlow.Text.Trim());
         if (flow != null)
         {
             this.LocationCode = flow.LocationFrom.Code;
             // this.InspectItemDic.Clear();
             InitPageParameter();
         }
     }
 }
示例#16
0
    protected void ODS_Strategy_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        Flow flow    = (Flow)e.InputParameters[0];
        Flow oldFlow = TheFlowMgr.LoadFlow(FlowCode);

        CloneHelper.CopyProperty(oldFlow, flow, EditFields, true);

        com.Sconit.Control.CodeMstrDropDownList ddlStrategy = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Strategy.FindControl("ddlStrategy");

        flow.FlowStrategy   = ddlStrategy.SelectedValue;
        flow.LastModifyUser = this.CurrentUser;
        flow.LastModifyDate = DateTime.Now;
        flow.Version       += 1;
    }
示例#17
0
    protected void FV_Routing_DataBound(object sender, EventArgs e)
    {
        if (FlowCode != null && FlowCode != string.Empty)
        {
            Flow flow = TheFlowMgr.LoadFlow(FlowCode);

            Controls_TextBox tbRouting    = (Controls_TextBox)(this.FV_Routing.FindControl("tbRouting"));
            Literal          lblRouting   = (Literal)this.FV_Routing.FindControl("lblRouting");
            Literal          lDescription = (Literal)(this.FV_Routing.FindControl("lDescription"));
            lblRouting.Text = FlowHelper.GetFlowRoutingLabel(this.ModuleType) + ":";
            if (this.ModuleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)
            {
                if (this.IsReturn)
                {
                    tbRouting.ServiceParameter = "string:" + BusinessConstants.CODE_MASTER_ROUTING_TYPE_VALUE_REWORK;
                }
                else
                {
                    tbRouting.ServiceParameter = "string:" + BusinessConstants.CODE_MASTER_ROUTING_TYPE_VALUE_PRODUCTION;
                }
                tbRouting.DataBind();
            }
            else
            {
                tbRouting.ServiceParameter = "string:" + BusinessConstants.CODE_MASTER_ROUTING_TYPE_VALUE_BINARY;
                tbRouting.DataBind();
            }
            if (!IsReturn)
            {
                if (flow.Routing != null)
                {
                    tbRouting.Text    = flow.Routing.Code;
                    lDescription.Text = flow.Routing.Description;
                    EditEvent(DoSearch(flow.Routing.Code, IsReturn), null);
                }
            }
            else
            {
                if (flow.ReturnRouting != null)
                {
                    lblRouting.Text   = "${MasterData.Flow.ReturnRouting}";
                    tbRouting.Text    = flow.ReturnRouting.Code;
                    lDescription.Text = flow.ReturnRouting.Description;
                    EditEvent(DoSearch(flow.ReturnRouting.Code, IsReturn), null);
                }
            }
        }
    }
示例#18
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        Flow currentFlow = TheFlowMgr.LoadFlow(tbFlow.Text.Trim());

        if (currentFlow != null)
        {
            if ((currentFlow.IsShipScanHu || currentFlow.IsReceiptScanHu) && !this.IsReject)
            {
                this.ucHuList.SaveCallBack();
            }
            else
            {
                this.ucList.SaveCallBack();
            }
        }
    }
示例#19
0
    protected void tbFlow_TextChanged(Object sender, EventArgs e)
    {
        try
        {
            this.ucList.Visible   = false;
            this.tbWinTime.Text   = string.Empty;
            this.tbStartTime.Text = string.Empty;
            if (this.CurrentFlowCode == null || this.CurrentFlowCode != this.tbFlow.Text)
            {
                Flow currentFlow = TheFlowMgr.LoadFlow(tbFlow.Text, this.CurrentUser.Code, true, this.ModuleType);
                if (currentFlow != null)
                {
                    this.CurrentFlowCode = currentFlow.Code;

                    this.cbReleaseOrder.Checked = currentFlow.IsAutoRelease;
                    this.cbPrintOrder.Checked   = currentFlow.NeedPrintOrder;

                    OrderHead orderHead = TheOrderMgr.TransferFlow2Order(currentFlow);
                    orderHead.SubType    = this.ModuleSubType;
                    orderHead.WindowTime = DateTime.Now;

                    this.ucList.InitPageParameter(orderHead);
                    this.ucList.Visible = true;
                    this.ucList.CleanPrice();
                    this.ucHuList.Visible = false;

                    this.hfLeadTime.Value = currentFlow.LeadTime.ToString();
                    this.hfEmTime.Value   = currentFlow.EmTime.ToString();

                    //  InitDetailParamater(orderHead);

                    this.BindShift();
                }
                else
                {
                    this.tbFlow.Text    = string.Empty;
                    this.ucList.Visible = false;
                }
            }
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
示例#20
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        Flow currentFlow = TheFlowMgr.LoadFlow(this.tbFlow.Text);

        if (currentFlow != null)
        {
            bool isScanHu = currentFlow.IsShipScanHu || currentFlow.IsReceiptScanHu || (currentFlow.CreateHuOption == BusinessConstants.CODE_MASTER_CREATE_HU_OPTION_VALUE_GI) || currentFlow.CreateHuOption == BusinessConstants.CODE_MASTER_CREATE_HU_OPTION_VALUE_GR;

            if (this.IsQuick && isScanHu && !this.IsReject)
            {
                this.ucHuList.SaveCallBack();
            }
            else
            {
                this.ucList.SaveCallBack();
            }
        }
    }
示例#21
0
    protected void ODS_FlowBinding_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
    {
        flowBinding            = (FlowBinding)e.InputParameters[0];
        flowBinding.MasterFlow = TheFlowMgr.LoadFlow(FlowCode);

        Controls_TextBox tbSlaveFlow = (Controls_TextBox)this.FV_FlowBinding.FindControl("tbSlaveFlow");

        com.Sconit.Control.CodeMstrDropDownList ddlBindingType = (com.Sconit.Control.CodeMstrDropDownList) this.FV_FlowBinding.FindControl("ddlBindingType");

        if (tbSlaveFlow != null && tbSlaveFlow.Text.Trim() != string.Empty)
        {
            flowBinding.SlaveFlow = TheFlowMgr.LoadFlow(tbSlaveFlow.Text);
        }

        if (ddlBindingType.SelectedIndex != -1)
        {
            flowBinding.BindingType = ddlBindingType.SelectedValue;
        }
    }
示例#22
0
    protected override void DoSearch()
    {
        if (!this.rfvFlow.Visible || SearchEvent != null)
        {
            string code = this.tbItemCode.Text != string.Empty ? this.tbItemCode.Text.Trim() : string.Empty;

            #region DetachedCriteria查询

            DetachedCriteria selectCriteria      = DetachedCriteria.For(typeof(FlowDetail));
            DetachedCriteria selectCountCriteria = DetachedCriteria.For(typeof(FlowDetail))
                                                   .SetProjection(Projections.Count("Id"));
            selectCriteria.AddOrder(Order.Asc("Sequence"));

            if (this.tbFlow.Text.Trim() != string.Empty && this.tbFlow.Text.Trim() != null)
            {
                this.FlowCode = this.tbFlow.Text.Trim();
            }

            if (FlowCode != null && FlowCode != string.Empty)
            {
                Flow flow = TheFlowMgr.LoadFlow(FlowCode);
                if (flow.ReferenceFlow != null && flow.ReferenceFlow.Trim() != string.Empty)
                {
                    //添加零件组引用明细
                    selectCriteria.Add(Expression.Or(Expression.Eq("Flow.Code", FlowCode), Expression.Eq("Flow.Code", flow.ReferenceFlow)));
                    selectCountCriteria.Add(Expression.Or(Expression.Eq("Flow.Code", FlowCode), Expression.Eq("Flow.Code", flow.ReferenceFlow)));
                }
                else
                {
                    selectCriteria.Add(Expression.Eq("Flow.Code", FlowCode));
                    selectCountCriteria.Add(Expression.Eq("Flow.Code", FlowCode));
                }
            }
            if (code != string.Empty)
            {
                selectCriteria.Add(Expression.Eq("Item.Code", code));
                selectCountCriteria.Add(Expression.Eq("Item.Code", code));
            }

            SearchEvent((new object[] { selectCriteria, selectCountCriteria, FlowCode }), null);
            #endregion
        }
    }
示例#23
0
    public void PageCleanup()
    {
        Flow             flow = TheFlowMgr.LoadFlow(this.FlowCode);
        Label            lblMasterFlowTypeValue = (Label)this.FV_FlowBinding.FindControl("lblMasterFlowTypeValue");
        Label            lblMasterFlowValue     = (Label)this.FV_FlowBinding.FindControl("lblMasterFlowValue");
        Controls_TextBox tbSlaveFlow            = (Controls_TextBox)this.FV_FlowBinding.FindControl("tbSlaveFlow");


        lblMasterFlowTypeValue.Text = flow.Type;

        lblMasterFlowValue.Text    = flow.Code;
        lblMasterFlowValue.ToolTip = flow.Description;


        // tbSlaveFlow.ServiceMethod = FlowHelper.GetFlowServiceMethod(this.ModuleType);
        tbSlaveFlow.ServiceParameter = "string:" + this.CurrentUser.Code;
        tbSlaveFlow.DataBind();

        tbSlaveFlow.Text = string.Empty;
    }
示例#24
0
    protected void ToInBT_Click(object sender, EventArgs e)
    {
        List <Flow> pList = new List <Flow>();

        foreach (ListItem item in this.CBL_NotInProductLine.Items)
        {
            if (item.Selected)
            {
                ProductLineUser pu = new ProductLineUser();
                pu.DeliveryUser = TheUserMgr.LoadUser(this.tbUser.Text.Trim());
                pu.ProductLine  = TheFlowMgr.LoadFlow(item.Value);
                TheProductLineUserMgr.CreateProductLineUser(pu);
            }
        }

        this.CBL_NotInProductLine.DataBind();
        this.CBL_InProductLine.DataBind();
        this.cb_InProductLine.Checked    = false;
        this.cb_NotInProductLine.Checked = false;
    }
示例#25
0
    protected void ODS_Routing_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        Flow flow    = (Flow)e.InputParameters[0];
        Flow oldFlow = TheFlowMgr.LoadFlow(FlowCode);

        CloneHelper.CopyProperty(oldFlow, flow, EditFields, true);

        Controls_TextBox tbRouting = (Controls_TextBox)(this.FV_Routing.FindControl("tbRouting"));

        if (!IsReturn)
        {
            flow.Routing = TheRoutingMgr.LoadRouting(tbRouting.Text);
        }
        else
        {
            flow.ReturnRouting = TheRoutingMgr.LoadRouting(tbRouting.Text);
        }
        flow.LastModifyUser = this.CurrentUser;
        flow.LastModifyDate = DateTime.Now;
        flow.Version       += 1;
    }
示例#26
0
    public override void UpdateView()
    {
        List <PriceListDetail> priceListDetailList = new List <PriceListDetail>();
        PriceList priceList = null;
        Flow      flow      = TheFlowMgr.LoadFlow(this.FlowCode, true);

        if (this.OrderType == BusinessConstants.BILL_TRANS_TYPE_PO)
        {
            priceList = flow.PriceListFrom;
        }
        else if (this.OrderType == BusinessConstants.BILL_TRANS_TYPE_SO)
        {
            priceList = flow.PriceListTo;
        }
        if (priceList != null)
        {
            if (flow.FlowDetails != null && flow.FlowDetails.Count > 0)
            {
                foreach (FlowDetail flowDetail in flow.FlowDetails)
                {
                    PriceListDetail priceListDetail = ThePriceListDetailMgr.GetLastestPriceListDetail(priceList, flowDetail.Item, DateTime.Now, flow.Currency);
                    if (priceListDetail != null)
                    {
                        priceListDetailList.Add(priceListDetail);
                    }
                }
            }
        }
        if (priceListDetailList.Count > 0)
        {
            this.GV_List.DataSource = priceListDetailList;
            this.GV_List.DataBind();
        }
        else
        {
            this.Parent.Visible = false;
        }
    }
示例#27
0
 protected void btnShip_Click(object sender, EventArgs e)
 {
     try
     {
         Flow   currentFlow = new Flow();
         string flowCode    = this.tbFlow.Text.Trim();
         if (string.IsNullOrEmpty(flowCode))
         {
             throw new BusinessErrorException("发货路线不能为空。");
         }
         else
         {
             currentFlow = TheFlowMgr.LoadFlow(flowCode, this.CurrentUser.Code, true);
             if (currentFlow == null)
             {
                 throw new BusinessErrorException("发货路线填写不正确。");
             }
         }
         List <EDIFordPlan> shipEDIFordPlanList = this.GetShipEDIFordPlan();
         if (shipEDIFordPlanList == null || shipEDIFordPlanList.Count == 0)
         {
             throw new BusinessErrorException("发货的有效数据为0,发货失败。");
         }
         TheEDIMgr.ShipEDIFordPlan(shipEDIFordPlanList, this.CurrentUser.Code, currentFlow);
         ShowSuccessMessage("发货成功。");
         this.tbFlow.Text = string.Empty;
         this.UpdateView();
         //if (ShipEvent != null)
         //{
         //    ShipEvent(new object[] { this.CacheResolver.Code, cbPrintAsn.Checked }, null);
         //}
     }
     catch (BusinessErrorException ex)
     {
         ShowErrorMessage(ex);
     }
 }
示例#28
0
    private void SaveRender(object sender, EventArgs e)
    {
        if (this.cvStartTime.IsValid || this.IsReject)
        {
            IList <OrderDetail> resultOrderDetailList = new List <OrderDetail>();
            OrderHead           orderHead             = CloneHelper.DeepClone <OrderHead>((OrderHead)sender); //Clone:避免修改List Page的TheOrder,导致出错

            if (orderHead != null && orderHead.OrderDetails != null && orderHead.OrderDetails.Count > 0)
            {
                foreach (OrderDetail orderDetail in orderHead.OrderDetails)
                {
                    if (orderDetail.OrderedQty != 0)
                    {
                        if (orderDetail.Item.Type == BusinessConstants.CODE_MASTER_ITEM_TYPE_VALUE_K)
                        {
                            IList <Item>    newItemList = new List <Item>(); //填充套件子件
                            decimal?        convertRate = null;
                            IList <ItemKit> itemKitList = null;

                            var maxSequence = orderHead.OrderDetails.Max(o => o.Sequence);
                            itemKitList = this.TheItemKitMgr.GetChildItemKit(orderDetail.Item);
                            for (int i = 0; i < itemKitList.Count; i++)
                            {
                                Item item = itemKitList[i].ChildItem;
                                if (!convertRate.HasValue)
                                {
                                    if (itemKitList[i].ParentItem.Uom.Code != orderDetail.Item.Uom.Code)
                                    {
                                        convertRate = this.TheUomConversionMgr.ConvertUomQty(orderDetail.Item, orderDetail.Item.Uom, 1, itemKitList[i].ParentItem.Uom);
                                    }
                                    else
                                    {
                                        convertRate = 1;
                                    }
                                }
                                OrderDetail newOrderDetail = new OrderDetail();

                                newOrderDetail.OrderHead     = orderDetail.OrderHead;
                                newOrderDetail.Sequence      = maxSequence + (i + 1);
                                newOrderDetail.IsBlankDetail = false;
                                newOrderDetail.Item          = item;



                                newOrderDetail.Uom         = item.Uom;
                                newOrderDetail.UnitCount   = orderDetail.Item.UnitCount * itemKitList[i].Qty * convertRate.Value;
                                newOrderDetail.OrderedQty  = orderDetail.OrderedQty * itemKitList[i].Qty * convertRate.Value;
                                newOrderDetail.PackageType = orderDetail.PackageType;

                                #region 价格字段

                                if (this.ModuleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT)
                                {
                                    if (orderDetail.PriceListFrom != null && orderDetail.PriceListFrom.Code != string.Empty)
                                    {
                                        newOrderDetail.PriceListFrom = ThePurchasePriceListMgr.LoadPurchasePriceList(orderDetail.PriceListFrom.Code);

                                        if (newOrderDetail.PriceListFrom != null)
                                        {
                                            newOrderDetail.PriceListDetailFrom = this.ThePriceListDetailMgr.GetLastestPriceListDetail(newOrderDetail.PriceListFrom, item, DateTime.Now, newOrderDetail.OrderHead.Currency, item.Uom);
                                        }
                                    }
                                }
                                else if (this.ModuleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
                                {
                                    if (orderDetail.PriceListTo != null && orderDetail.PriceListTo.Code != string.Empty)
                                    {
                                        newOrderDetail.PriceListTo = TheSalesPriceListMgr.LoadSalesPriceList(orderDetail.PriceListTo.Code);
                                    }
                                    if (newOrderDetail.PriceListTo != null)
                                    {
                                        newOrderDetail.PriceListDetailTo = this.ThePriceListDetailMgr.GetLastestPriceListDetail(newOrderDetail.PriceListTo, item, DateTime.Now, newOrderDetail.OrderHead.Currency, item.Uom);
                                    }
                                }

                                #endregion
                                resultOrderDetailList.Add(newOrderDetail);
                            }
                        }
                        else
                        {
                            resultOrderDetailList.Add(orderDetail);
                        }
                    }
                }
            }
            if (resultOrderDetailList.Count == 0)
            {
                this.ShowErrorMessage("MasterData.Order.OrderHead.OrderDetail.Required");
                return;
            }
            else
            {
                Flow currentFlow = TheFlowMgr.LoadFlow(CurrentFlowCode, true);

                DateTime winTime   = this.tbWinTime.Text.Trim() == string.Empty ? DateTime.Now : DateTime.Parse(this.tbWinTime.Text);
                DateTime startTime = winTime;

                if (this.tbStartTime.Text != string.Empty)
                {
                    startTime = DateTime.Parse(this.tbStartTime.Text.Trim());
                }
                else
                {
                    double leadTime = this.hfLeadTime.Value == string.Empty ? 0 : double.Parse(this.hfLeadTime.Value);
                    double emTime   = this.hfEmTime.Value == string.Empty ? 0 : double.Parse(this.hfEmTime.Value);
                    double lTime    = this.cbIsUrgent.Checked ? emTime : leadTime;
                    startTime = winTime.AddHours(0 - lTime);
                }

                orderHead.OrderDetails  = resultOrderDetailList;
                orderHead.WindowTime    = winTime;
                orderHead.StartTime     = startTime;
                orderHead.IsAutoRelease = this.cbReleaseOrder.Checked;

                orderHead.IsNewItem = this.NewItem;
                if (this.cbIsUrgent.Checked)
                {
                    orderHead.Priority = BusinessConstants.CODE_MASTER_ORDER_PRIORITY_VALUE_URGENT;
                }
                else
                {
                    orderHead.Priority = BusinessConstants.CODE_MASTER_ORDER_PRIORITY_VALUE_NORMAL;
                }
                if (this.tbRefOrderNo.Text.Trim() != string.Empty)
                {
                    orderHead.ReferenceOrderNo = this.tbRefOrderNo.Text.Trim();
                }
                if (this.tbExtOrderNo.Text.Trim() != string.Empty)
                {
                    orderHead.ExternalOrderNo = this.tbExtOrderNo.Text.Trim();
                }
            }

            //创建订单
            try
            {
                if (this.IsQuick)
                {
                    Receipt receipt = TheOrderMgr.QuickReceiveOrder(orderHead.Flow, orderHead.OrderDetails, this.CurrentUser.Code, this.ModuleSubType, orderHead.WindowTime, orderHead.StartTime, this.cbIsUrgent.Checked, orderHead.ReferenceOrderNo, orderHead.ExternalOrderNo);
                    if (receipt.ReceiptDetails != null && receipt.ReceiptDetails.Count > 0)
                    {
                        orderHead = receipt.ReceiptDetails[0].OrderLocationTransaction.OrderDetail.OrderHead;
                        if (this.cbPrintOrder.Checked)
                        {
                            IList <OrderDetail> orderDetails = orderHead.OrderDetails;
                            IList <object>      list         = new List <object>();
                            list.Add(orderHead);
                            list.Add(orderDetails);

                            IList <OrderLocationTransaction> orderLocationTransactions = TheOrderLocationTransactionMgr.GetOrderLocationTransaction(orderHead.OrderNo);
                            list.Add(orderLocationTransactions);

                            //TheReportProductionMgr.FillValues(orderHead.OrderTemplate, list);
                            string printUrl = TheReportMgr.WriteToFile(orderHead.OrderTemplate, list);

                            Page.ClientScript.RegisterStartupScript(GetType(), "method", " <script language='javascript' type='text/javascript'>PrintOrder('" + printUrl + "'); </script>");
                        }
                    }
                    this.ShowSuccessMessage("Receipt.Receive.Successfully", receipt.ReceiptNo);

                    if (!this.cbContinuousCreate.Checked)
                    {
                        this.PageCleanup();
                        if (QuickCreateEvent != null)
                        {
                            QuickCreateEvent(new Object[] { receipt, orderHead.NeedPrintReceipt }, e);
                        }
                    }
                    else
                    {
                        orderHead = TheOrderMgr.TransferFlow2Order(this.tbFlow.Text.Trim());
                        InitDetailParamater(orderHead);
                    }
                }
                else
                {
                    TheOrderMgr.CreateOrder(orderHead, this.CurrentUser);
                    if (this.cbPrintOrder.Checked)
                    {
                        IList <OrderDetail> orderDetails = orderHead.OrderDetails;
                        IList <object>      list         = new List <object>();
                        list.Add(orderHead);
                        list.Add(orderDetails);

                        IList <OrderLocationTransaction> orderLocationTransactions = TheOrderLocationTransactionMgr.GetOrderLocationTransaction(orderHead.OrderNo);
                        list.Add(orderLocationTransactions);

                        //TheReportProductionMgr.FillValues(orderHead.OrderTemplate, list);
                        string printUrl = TheReportMgr.WriteToFile(orderHead.OrderTemplate, list);

                        Page.ClientScript.RegisterStartupScript(GetType(), "method", " <script language='javascript' type='text/javascript'>PrintOrder('" + printUrl + "'); </script>");
                    }
                    this.ShowSuccessMessage("MasterData.Order.OrderHead.AddOrder.Successfully", orderHead.OrderNo);
                    if (!this.cbContinuousCreate.Checked)
                    {
                        this.PageCleanup();
                        if (CreateEvent != null)
                        {
                            CreateEvent(orderHead.OrderNo, e);
                        }
                    }
                    else
                    {
                        orderHead = TheOrderMgr.TransferFlow2Order(this.tbFlow.Text.Trim());
                        InitDetailParamater(orderHead);
                    }
                }
            }
            catch (BusinessErrorException ex)
            {
                this.ShowErrorMessage(ex);
                return;
            }
        }
    }
示例#29
0
    protected void ODS_Flow_Updating(object sender, ObjectDataSourceMethodEventArgs e)
    {
        Flow flow    = (Flow)e.InputParameters[0];
        Flow oldFlow = TheFlowMgr.LoadFlow(FlowCode);

        CloneHelper.CopyProperty(oldFlow, flow, EditFields, true);

        Controls_TextBox tbRefFlow   = (Controls_TextBox)this.FV_Flow.FindControl("tbRefFlow");
        Controls_TextBox tbPartyFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbPartyFrom");
        Controls_TextBox tbPartyTo   = (Controls_TextBox)this.FV_Flow.FindControl("tbPartyTo");

        Controls_TextBox tbLocFrom = (Controls_TextBox)this.FV_Flow.FindControl("tbLocFrom");
        Controls_TextBox tbLocTo   = (Controls_TextBox)this.FV_Flow.FindControl("tbLocTo");

        com.Sconit.Control.CodeMstrDropDownList ddlGrGapTo           = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlGrGapTo");
        com.Sconit.Control.CodeMstrDropDownList ddlCheckDetailOption = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlCheckDetailOption"));

        com.Sconit.Control.CodeMstrDropDownList ddlOrderTemplate   = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlOrderTemplate"));
        com.Sconit.Control.CodeMstrDropDownList ddlAsnTemplate     = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlAsnTemplate"));
        com.Sconit.Control.CodeMstrDropDownList ddlReceiptTemplate = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlReceiptTemplate"));
        com.Sconit.Control.CodeMstrDropDownList ddlHuTemplate      = (com.Sconit.Control.CodeMstrDropDownList)(this.FV_Flow.FindControl("ddlHuTemplate"));

        com.Sconit.Control.CodeMstrDropDownList ddlCreateHuOption = (com.Sconit.Control.CodeMstrDropDownList) this.FV_Flow.FindControl("ddlCreateHuOption");

        Controls_TextBox tbTPriceList         = (Controls_TextBox)this.FV_Flow.FindControl("tbTPriceList");
        Controls_TextBox tbTRoute             = (Controls_TextBox)this.FV_Flow.FindControl("tbTRoute");
        Controls_TextBox tbCarrier            = (Controls_TextBox)this.FV_Flow.FindControl("tbCarrier");
        Controls_TextBox tbCarrierBillAddress = (Controls_TextBox)this.FV_Flow.FindControl("tbCarrierBillAddress");
        Controls_TextBox tbCurrency           = (Controls_TextBox)this.FV_Flow.FindControl("tbCurrency");

        if (tbRefFlow != null && tbRefFlow.Text.Trim() != string.Empty)
        {
            flow.ReferenceFlow = TheFlowMgr.CheckAndLoadFlow(tbRefFlow.Text.Trim()).Code;
        }
        if (tbPartyFrom != null && tbPartyFrom.Text.Trim() != string.Empty)
        {
            flow.PartyFrom = ThePartyMgr.LoadParty(tbPartyFrom.Text.Trim());
        }
        if (tbPartyTo != null && tbPartyTo.Text.Trim() != string.Empty)
        {
            flow.PartyTo = ThePartyMgr.LoadParty(tbPartyTo.Text.Trim());
        }
        if (tbLocFrom != null && tbLocFrom.Text.Trim() != string.Empty)
        {
            flow.LocationFrom = TheLocationMgr.LoadLocation(tbLocFrom.Text.Trim());
        }
        if (tbLocTo != null && tbLocTo.Text.Trim() != string.Empty)
        {
            flow.LocationTo = TheLocationMgr.LoadLocation(tbLocTo.Text.Trim());
        }
        if (ddlOrderTemplate.SelectedIndex != -1)
        {
            flow.OrderTemplate = ddlOrderTemplate.SelectedValue;
        }
        if (ddlAsnTemplate.SelectedIndex != -1)
        {
            flow.AsnTemplate = ddlAsnTemplate.SelectedValue;
        }
        if (ddlReceiptTemplate.SelectedIndex != -1)
        {
            flow.ReceiptTemplate = ddlReceiptTemplate.SelectedValue;
        }
        if (ddlHuTemplate.SelectedIndex != -1)
        {
            flow.HuTemplate = ddlHuTemplate.SelectedValue;
        }
        if (ddlGrGapTo.SelectedIndex != -1)
        {
            flow.GoodsReceiptGapTo = ddlGrGapTo.SelectedValue;
        }
        if (ddlCheckDetailOption.SelectedIndex != -1)
        {
            flow.CheckDetailOption = ddlCheckDetailOption.SelectedValue;
        }
        if (ddlCreateHuOption.SelectedIndex != -1)
        {
            flow.CreateHuOption = ddlCreateHuOption.SelectedValue;
        }
        if (tbTPriceList != null && tbTPriceList.Text.Trim() != string.Empty)
        {
            flow.TransportPriceList = TheTransportPriceListMgr.LoadTransportPriceList(tbTPriceList.Text.Trim());
        }
        if (tbTRoute != null && tbTRoute.Text.Trim() != string.Empty)
        {
            flow.TransportationRoute = TheTransportationRouteMgr.LoadTransportationRoute(tbTRoute.Text.Trim());
        }
        if (tbCarrier != null && tbCarrier.Text.Trim() != string.Empty)
        {
            flow.Carrier = TheCarrierMgr.LoadCarrier(tbCarrier.Text.Trim());
        }
        if (tbCarrierBillAddress != null && tbCarrierBillAddress.Text.Trim() != string.Empty)
        {
            flow.CarrierBillAddress = TheAddressMgr.LoadBillAddress(tbCarrierBillAddress.Text.Trim());
        }
        if (tbCurrency != null && tbCurrency.Text.Trim() != string.Empty)
        {
            flow.Currency = TheCurrencyMgr.LoadCurrency(tbCurrency.Text.Trim());
        }
        else
        {
            string currencyCode = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_BASE_CURRENCY).Value;
            flow.Currency = TheCurrencyMgr.LoadCurrency(currencyCode);
        }
        flow.BillSettleTerm    = null;
        flow.CheckDetailOption = BusinessConstants.CODE_MASTER_CHECK_ORDER_DETAIL_OPTION_VALUE_NOT_CHECK;
        flow.LastModifyUser    = this.CurrentUser;
        flow.LastModifyDate    = DateTime.Now;
        flow.Version          += 1;
    }
示例#30
0
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        try
        {
            HSSFWorkbook excel = new HSSFWorkbook(fileUpload.PostedFile.InputStream);
            Sheet        sheet = excel.GetSheetAt(0);
            IEnumerator  rows  = sheet.GetRowEnumerator();
            ImportHelper.JumpRows(rows, 10);
            //供货路线	窗口时间	物料号	订单数

            #region 列定义
            int colFlow       = 1; //供货路线
            int colWindowTime = 2; //窗口时间
            int colItem       = 3; // 物料号
            int colQty        = 4; //订单数
            #endregion
            int rowCount = 10;
            //IList<Exception> exceptionList = new List<Exception>();
            //Exception exceptio = new Exception();
            string            errorMessage  = string.Empty;
            IList <OrderHead> orderHeadList = new List <OrderHead>();
            while (rows.MoveNext())
            {
                rowCount++;
                HSSFRow row = (HSSFRow)rows.Current;
                if (!TheImportMgr.CheckValidDataRow(row, 1, 4))
                {
                    break;//边界
                }
                string    flowCode    = string.Empty;
                DateTime  windowTime  = DateTime.Now;
                string    itemCode    = string.Empty;
                decimal   qty         = 0;
                OrderHead orderHead   = new OrderHead();
                Flow      currentFlow = new Flow();

                #region 读取数据
                #region 供货路线
                flowCode = row.GetCell(colFlow) != null?row.GetCell(colFlow).StringCellValue : string.Empty;

                if (string.IsNullOrEmpty(flowCode))
                {
                    //ShowErrorMessage(string.Format("第{0}行:供货路线不能为空。", rowCount));
                    errorMessage += string.Format("第{0}行:供货路线不能为空。<br/>", rowCount);
                    continue;
                }
                else
                {
                    currentFlow = TheFlowMgr.LoadFlow(flowCode, this.CurrentUser.Code, true);
                }
                #endregion

                #region 读取窗口时间
                try
                {
                    string readwindowTime = row.GetCell(colWindowTime).StringCellValue;
                    if (DateTime.TryParse(readwindowTime, out windowTime))
                    {
                        orderHead.WindowTime = windowTime;
                    }
                    else
                    {
                        errorMessage += string.Format("第{0}行:窗口时间填写有误。<br/>", rowCount);
                        continue;
                    }
                }
                catch
                {
                    errorMessage += string.Format("第{0}行:窗口时间填写有误。<br/>", rowCount);
                    //ShowErrorMessage(string.Format("第{0}行:窗口时间填写有误。", rowCount));
                    continue;
                }
                #endregion

                #region 读取物料代码
                itemCode = row.GetCell(colItem) != null?row.GetCell(colItem).StringCellValue : string.Empty;

                if (itemCode == null || itemCode.Trim() == string.Empty)
                {
                    errorMessage += string.Format("第{0}行:物料代码不能为空。<br/>", rowCount);
                    //ShowErrorMessage(string.Format("第{0}行:物料代码不能为空。", rowCount));
                    continue;
                }
                else
                {
                    currentFlow.FlowDetails = currentFlow.FlowDetails.Where(f => f.Item.Code == itemCode).ToList();
                    if (currentFlow.FlowDetails.Count == 0)
                    {
                        errorMessage += string.Format("第{0}行:物料代码{1}在路线{2}中不存在。<br/>", rowCount, itemCode, flowCode);
                        continue;
                    }
                }

                #endregion

                #region 读取数量
                try
                {
                    qty = Convert.ToDecimal(row.GetCell(colQty).NumericCellValue);
                }
                catch
                {
                    //ShowErrorMessage(string.Format("第{0}行:订单数量填写有误。<br/>", rowCount));
                    errorMessage += string.Format("第{0}行:订单数量填写有误。<br/>", rowCount);
                    continue;
                }
                #endregion
                #endregion

                #region 填充数据
                orderHead            = TheOrderMgr.TransferFlow2Order(currentFlow);
                orderHead.SubType    = "Nml";
                orderHead.WindowTime = windowTime;
                orderHead.Priority   = "Normal";
                //orderHead.Type = "Procurement";
                orderHead.StartTime     = System.DateTime.Now;
                orderHead.IsAutoRelease = true;
                foreach (OrderDetail det in orderHead.OrderDetails)
                {
                    det.RequiredQty = qty;
                    det.OrderedQty  = qty;
                }
                orderHeadList.Add(orderHead);
                #endregion
            }
            if (!string.IsNullOrEmpty(errorMessage))
            {
                throw new Exception(errorMessage);
            }
            if (orderHeadList.Count == 0)
            {
                throw new Exception("导入的有效数据为0.");
            }
            var groups = (from tak in orderHeadList
                          group tak by new
            {
                tak.WindowTime,
                tak.Flow,
            }
                          into result
                          select new
            {
                WindowTime = result.Key.WindowTime,
                Flow = result.Key.Flow,
                list = result.ToList()
            }
                          ).ToList();
            string orderNos = "导入成功,生成单号:";
            foreach (var order in groups)
            {
                OrderHead           newOrderHead = order.list.First();
                IList <OrderDetail> detList      = new List <OrderDetail>();
                //OrderHead newOrderHead = new OrderHead();
                foreach (var d in order.list)
                {
                    OrderDetail det = d.OrderDetails.First();
                    det.OrderHead = newOrderHead;
                    detList.Add(det);
                }
                newOrderHead.OrderDetails = detList;
                CreateOrder(newOrderHead);
                orderNos += newOrderHead.OrderNo + ",";
            }
            ShowSuccessMessage(orderNos);
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
        catch (Exception ex)
        {
            ShowErrorMessage(ex.Message);
            return;
        }
    }