Beispiel #1
0
    protected void tbOrderNo_TextChanged(Object sender, EventArgs e)
    {
        try
        {
            if (this.CurrentOrderNo == null || this.CurrentOrderNo != this.tbOrderNo.Text.Trim())
            {
                OrderHead currentOrderHead = TheOrderMgr.LoadOrder(this.tbOrderNo.Text.Trim(), this.CurrentUser);

                if (currentOrderHead.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CANCEL ||
                    currentOrderHead.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE ||
                    currentOrderHead.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE)
                {
                    this.ShowErrorMessage("Inventory.Error.PrintHu.OrderStatus", currentOrderHead.OrderNo, currentOrderHead.Status);
                    return;
                }

                if (currentOrderHead.SubType != BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_NML)
                {
                    this.ShowErrorMessage("Inventory.Error.PrintHu.OrderSubType", currentOrderHead.OrderNo, currentOrderHead.SubType);
                    return;
                }

                currentOrderHead.OrderDetails = TheOrderDetailMgr.GetOrderDetail(currentOrderHead);
                this.CurrentOrderNo           = currentOrderHead.OrderNo;

                this.ucList.InitPageParameter(currentOrderHead);
                this.ucList.Visible = true;
            }
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
Beispiel #2
0
    protected void btnOrderNo_Click(object sender, EventArgs e)
    {
        this.lblMessage.Text = string.Empty;
        this.OrderNo         = this.tbOrderNo.Text.Trim();
        OrderHead orderHead = null;

        try
        {
            orderHead = TheOrderMgr.LoadOrder(this.OrderNo, this.CurrentUser);
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
            this.tbOrderNo.Text = string.Empty;
            this.tbOrderNo.Focus();
        }
        if (orderHead != null)
        {
            this.gv_List.DataSource = TheOrderDetailMgr.GetOrderDetail(this.OrderNo);
            this.gv_List.DataBind();
            this.tbOrderNo.ReadOnly    = true;
            this.gv_List.Visible       = false;
            this.gv_Hu.Visible         = true;
            this.btn_Hu_Create.Visible = true;
            this.btnReceive.Visible    = false;
            InitPageParameter(orderHead.PartyFrom.Code);
        }
    }
    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);
        }
    }
Beispiel #4
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        try
        {
            // this.ucDetail.SaveCallBack();
            Receipt receipt = new Receipt();
            if (this.IsReuse)
            {
                GetLocTransHuListEvent(sender, e);
                if (this.HuList != null && this.HuList.Count > 0)
                {
                    receipt = TheOrderMgr.ReleaseReuseOrder(this.OrderNo, this.CurrentUser, this.HuList);
                }
                else
                {
                    receipt = TheOrderMgr.ReleaseScrapOrder(this.OrderNo, this.CurrentUser);
                }
            }
            else
            {
                receipt = TheOrderMgr.ReleaseScrapOrder(this.OrderNo, this.CurrentUser);
            }
            this.FV_Order.DataBind();

            ShowSuccessMessage("MasterData.Order.OrderHead.Confirm.Successfully", this.OrderNo, receipt.ReceiptNo);
            UpdateView();

            UpdateLocTransAndActBillEvent(this.OrderNo, null);
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
Beispiel #5
0
    protected void btnStart_Click(object sender, EventArgs e)
    {
        IList <string> orderList = GetSelectOrder();

        if (orderList.Count == 0)
        {
            ShowErrorMessage("MasterData.Order.BatchCheckIn.PleaseSelectOrder");
        }
        else
        {
            try
            {
                foreach (string orderNo in orderList)
                {
                    TheOrderMgr.StartOrder(orderNo, this.CurrentUser.Code);
                }
                ShowSuccessMessage("MasterData.Order.BatchStart.Successfully");
                InitPageParameter(this.FlowCode);
            }
            catch (BusinessErrorException ex)
            {
                this.ShowErrorMessage(ex);
            }
        }
    }
Beispiel #6
0
 protected void tbWinTime_TextChanged(object sender, EventArgs e)
 {
     if (tbWinTime.Text.Trim() != string.Empty && tbFlow.Text.Trim() != string.Empty)
     {
         OrderHead orderHead = TheOrderMgr.TransferFlow2Order(this.tbFlow.Text.Trim());
         orderHead.SubType    = this.ModuleSubType;
         orderHead.WindowTime = DateTime.Parse(tbWinTime.Text.Trim());
         InitDetailParamater(orderHead);
     }
 }
Beispiel #7
0
    /// <summary>
    /// 参考表单
    /// 同一零件号的第一张工单的编号
    /// 将成为后续工单的参考工单号
    /// djin 2012-06-21
    /// </summary>
    /// <param name="sender"></param>
    public void Create(object sender)
    {
        try
        {
            string        sqlText    = string.Empty;
            string        ConnString = string.Empty;
            XmlTextReader reader     = new XmlTextReader(Server.MapPath("Config/properties.config"));
            XmlDocument   doc        = new XmlDocument();
            doc.Load(reader); //
            reader.Close();   //
            ConnString = doc.SelectSingleNode("/configuration/properties/connectionString").InnerText.Trim();

            IList <OrderHead> orderHeadList = (IList <OrderHead>)sender;
            if (orderHeadList != null && orderHeadList.Count > 0)
            {
                string shiftCode = this.ucShift.ShiftCode;
                Shift  shift     = TheShiftMgr.LoadShift(shiftCode);
                foreach (var item in orderHeadList)
                {
                    item.Shift = shift;
                }
                TheOrderMgr.CreateOrder(orderHeadList, this.CurrentUser.Code);
                var result = (from order in orderHeadList select order.OrderDetails[0].Item.Code).Distinct();

                foreach (var s in result)
                {
                    var _ordNo = (from order in orderHeadList
                                  where order.OrderDetails[0].Item.Code == s
                                  orderby order.WinDate, order.WindowTime
                                  select order.OrderNo);
                    int    i          = 0;
                    string refOrderNo = string.Empty;
                    foreach (var ord in _ordNo)
                    {
                        UpdateOrderMstr(ord, refOrderNo, ConnString);
                        if (i == 0)
                        {
                            refOrderNo = ord;
                        }

                        i++;
                    }
                }



                ShowSuccessMessage("Common.Business.Result.Insert.Successfully");
            }
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }
Beispiel #8
0
 private void Import()
 {
     try
     {
         string    flowCode  = this.tbFlow.Text.Trim() != string.Empty ? this.tbFlow.Text.Trim() : string.Empty;
         OrderHead orderHead = TheImportMgr.ReadBatchTransferFromXls(fileUpload.PostedFile.InputStream, this.CurrentUser, flowCode);
         Receipt   receipt   = TheOrderMgr.QuickReceiveOrder(flowCode, orderHead.OrderDetails, this.CurrentUser.Code);
         this.ShowSuccessMessage("Receipt.Receive.Successfully", receipt.ReceiptNo);
     }
     catch (BusinessErrorException ex)
     {
         ShowErrorMessage(ex);
     }
 }
Beispiel #9
0
 protected void btnComplete_Click(object sender, EventArgs e)
 {
     try
     {
         TheOrderMgr.ManualCompleteOrder(this.OrderNo, this.CurrentUser);
         this.FV_Order.DataBind();
         UpdateView();
         ShowSuccessMessage("MasterData.Order.OrderHead.Complete.Successfully", this.OrderNo);
     }
     catch (BusinessErrorException ex)
     {
         this.ShowErrorMessage(ex);
     }
 }
Beispiel #10
0
    protected void btnShip_Click(object sender, EventArgs e)
    {
        string pickListNo = this.tbPickListNo.Text;

        try
        {
            TheOrderMgr.ShipOrder(pickListNo, this.CurrentUser);
            ShowSuccessMessage("MasterData.PickList.ShipPickList.Successfully", this.tbPickListNo.Text.Trim());
            DoSearch();
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
Beispiel #11
0
    protected void lbtnDelete_Click(object sender, EventArgs e)
    {
        string orderNo = ((LinkButton)sender).CommandArgument;

        try
        {
            TheOrderMgr.DeleteOrder(orderNo, this.CurrentUser);
            ShowSuccessMessage("Order.DeleteOrder.Successfully", orderNo);
            UpdateView();
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }
Beispiel #12
0
    public override void UpdateView()
    {
        List <OrderLocationTransaction> orderLocationTransactionInList  = new List <OrderLocationTransaction>();
        List <OrderLocationTransaction> orderLocationTransactionOutList = new List <OrderLocationTransaction>();

        try
        {
            OrderHead orderHead = TheOrderMgr.TransferFlow2Order(this.FlowCode, true);
            if (orderHead.OrderDetails != null)
            {
                foreach (OrderDetail orderDetail in orderHead.OrderDetails)
                {
                    if (orderDetail.OrderLocationTransactions != null)
                    {
                        foreach (OrderLocationTransaction orderLocationTransaction in orderDetail.OrderLocationTransactions)
                        {
                            if (orderLocationTransaction.IOType == BusinessConstants.IO_TYPE_IN)
                            {
                                orderLocationTransactionInList.Add(orderLocationTransaction);
                            }
                            else if (
                                orderLocationTransaction.IOType == BusinessConstants.IO_TYPE_OUT)
                            {
                                orderLocationTransactionOutList.Add(orderLocationTransaction);
                            }
                        }
                    }
                }
            }
            if (this.IOType == BusinessConstants.IO_TYPE_IN)
            {
                this.GV_List.DataSource = orderLocationTransactionInList;

                this.Parent.Visible = orderLocationTransactionInList.Count == 0 ? false : true;
            }
            else if (this.IOType == BusinessConstants.IO_TYPE_OUT)
            {
                this.GV_List.DataSource         = orderLocationTransactionOutList;
                this.GV_List.Columns[6].Visible = false;
                this.Parent.Visible             = orderLocationTransactionOutList.Count == 0 ? false : true;
            }
            this.GV_List.DataBind();
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }
Beispiel #13
0
 public void Create(object sender)
 {
     try
     {
         IList <OrderHead> orderHeadList = (IList <OrderHead>)sender;
         if (orderHeadList != null && orderHeadList.Count > 0)
         {
             TheOrderMgr.CreateOrder(orderHeadList, this.CurrentUser.Code);
             ShowSuccessMessage("Common.Business.Result.Insert.Successfully");
         }
     }
     catch (BusinessErrorException ex)
     {
         ShowErrorMessage(ex);
     }
 }
Beispiel #14
0
    private void ShipRender(object sender, EventArgs e)
    {
        OrderHead orderHead = (OrderHead)sender;

        try
        {
            InProcessLocation inProcessLocation = TheOrderMgr.ShipOrder(orderHead.OrderDetails, this.CurrentUser);
            this.FV_Order.DataBind();
            UpdateView();
            ShowSuccessMessage("MasterData.Order.OrderHead.Update.Successfully", this.OrderNo);
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
    protected void lbtnDelete_Click(object sender, EventArgs e)
    {
        int id = int.Parse(((LinkButton)sender).CommandArgument);
        OrderLocationTransaction orderLocationTrans = TheOrderLocationTransactionMgr.LoadOrderLocationTransaction(id);

        try
        {
            TheOrderMgr.DeleteOrderLocationTransaction(id, this.CurrentUser.Code);
            ShowSuccessMessage("MasterData.Order.LocTrans.Delete.Successfully");
            UpdateRoutingEvent(this.OrderNo, e);
            UpdateView();
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }
Beispiel #16
0
    private void ReceiveRender(object sender, EventArgs e)
    {
        OrderHead orderHead     = this.ucDetail.PopulateReceiveOrder();
        bool      isOddCreateHu = (bool)sender;

        try
        {
            Receipt receipt = TheOrderMgr.ReceiveOrder(orderHead.OrderDetails, this.CurrentUser, isOddCreateHu);
            this.FV_Order.DataBind();
            UpdateView();
            ShowSuccessMessage("MasterData.Order.OrderHead.Receive.Successfully", this.OrderNo);
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
Beispiel #17
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);
        }
    }
Beispiel #18
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        try
        {
            TheOrderMgr.DeleteOrder(this.OrderNo, this.CurrentUser);

            if (this.BackEvent != null)
            {
                this.BackEvent(this, e);
                this.PageCleanup();
            }
            ShowSuccessMessage("MasterData.Order.OrderHead.Delete.Successfully", this.OrderNo);
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
Beispiel #19
0
    public bool sendDeliveryOrder(DeliveryOrder order, string userCode)
    {
        IList <OrderDetail> orderDetailList = new List <OrderDetail>();

        if (order != null && order.deliveryOrderItems != null && order.deliveryOrderItems.Length > 0)
        {
            foreach (DeliveryOrderItem item in order.deliveryOrderItems)
            {
                OrderDetail orderDetail = TheOrderDetailMgr.LoadOrderDetail(int.Parse(item.id));
                orderDetail.CurrentShipQty = Convert.ToDecimal(item.deliveryQuantity);
                orderDetailList.Add(orderDetail);
            }
            TheOrderMgr.ShipOrder(orderDetailList, userCode);
        }


        return(true);
    }
Beispiel #20
0
 protected void btnImport_Click(object sender, EventArgs e)
 {
     try
     {
         IList <OrderLocationTransaction> orderLoctransList = TheImportMgr.ReadOrderLocationTransactionFromXls(fileUpload.PostedFile.InputStream, OrderNo);
         TheOrderMgr.AddOrderLocationTransaction(orderLoctransList, this.CurrentUser);
         ShowSuccessMessage("Import.Result.Successfully");
         if (BtnImportEvent != null)
         {
             this.Visible = false;
             BtnImportEvent(sender, e);
         }
     }
     catch (BusinessErrorException ex)
     {
         ShowErrorMessage(ex);
     }
 }
Beispiel #21
0
    private void ShipRender(object sender, EventArgs e)
    {
        OrderHead orderHead = (OrderHead)sender;

        try
        {
            TheOrderMgr.ShipOrder(orderHead.OrderDetails, this.CurrentUser);
            this.FV_Order.DataBind();
            UpdateView();
            ShowSuccessMessage("MasterData.Order.OrderHead.Ship.Successfully", this.OrderNo);

            //    if (inProcessLocation != null)
            //    {

            //        IList<object> huDetailObj = new List<object>();
            //        IList<HuDetail> huDetailList = new List<HuDetail>();
            //        IList<InProcessLocationDetail> inProcessLocationDetailList = inProcessLocation.InProcessLocationDetails;
            //        if (inProcessLocationDetailList != null && inProcessLocationDetailList.Count > 0)
            //        {
            //            foreach (InProcessLocationDetail inProcessLocationDetail in inProcessLocationDetailList)
            //            {
            //                HuDetail huDetail = TheHuDetailMgr.LoadHuDetail(inProcessLocationDetail.HuId, inProcessLocationDetail.LotNo, inProcessLocationDetail.OrderLocationTransaction.Item.Code);
            //                if (huDetail != null)
            //                {
            //                    huDetailList.Add(huDetail);
            //                }
            //            }
            //            if (huDetailList != null && huDetailList.Count > 0)
            //            {
            //                huDetailObj.Add(huDetailList);
            //                huDetailObj.Add(CurrentUser.Code);
            //                //TheReportBarCodeMgr.FillValues("BarCode.xls", huDetailObj);
            //                string barCodeUrl = TheReportMgr.WriteToFile("BarCode.xls", huDetailObj,"BarCode.xls");
            //                Page.ClientScript.RegisterStartupScript(GetType(), "method", " <script language='javascript' type='text/javascript'>PrintOrder('" + barCodeUrl + "'); </script>");
            //            }
            //        }
            //    }
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
Beispiel #22
0
    private void SaveRender(object sender, EventArgs e)
    {
        OrderHead orderHead = (OrderHead)sender;

        TextBox tbExtOrderNo = (TextBox)this.FV_Order.FindControl("tbExtOrderNo");
        TextBox tbRefOrderNo = (TextBox)this.FV_Order.FindControl("tbRefOrderNo");
        TextBox tbMemo       = (TextBox)this.FV_Order.FindControl("tbMemo");
        TextBox tbWinTime    = (TextBox)this.FV_Order.FindControl("tbWinTime");
        TextBox tbStartTime  = (TextBox)this.FV_Order.FindControl("tbStartTime");

        if (tbExtOrderNo != null && tbExtOrderNo.Text.Trim() != string.Empty)
        {
            orderHead.ExternalOrderNo = tbExtOrderNo.Text.Trim();
        }
        if (tbRefOrderNo != null && tbRefOrderNo.Text.Trim() != string.Empty)
        {
            orderHead.ReferenceOrderNo = tbRefOrderNo.Text.Trim();
        }
        if (tbMemo != null && tbMemo.Text.Trim() != string.Empty)
        {
            orderHead.Memo = tbMemo.Text.Trim();
        }
        if (tbWinTime != null && tbWinTime.Text.Trim() != string.Empty)
        {
            orderHead.WindowTime = DateTime.Parse(tbWinTime.Text.Trim());
        }
        if (tbStartTime != null && tbStartTime.Text.Trim() != string.Empty)
        {
            orderHead.StartTime = DateTime.Parse(tbStartTime.Text.Trim());
        }

        try
        {
            TheOrderMgr.UpdateOrder(orderHead, this.CurrentUser, true);
            this.FV_Order.DataBind();
            UpdateView();
            ShowSuccessMessage("MasterData.Order.OrderHead.Update.Successfully", this.OrderNo);
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
Beispiel #23
0
    private void Import()
    {
        try
        {
            string   partyCode      = this.tbRegion.Text.Trim() != string.Empty ? this.tbRegion.Text.Trim() : string.Empty;
            string   timePeriodType = this.ucDateSelect.TimePeriodType;
            DateTime date           = this.ucDateSelect.Date;

            IList <FlowPlan>  flowPlanList = TheImportMgr.ReadShipScheduleYFKFromXls(fileUpload.PostedFile.InputStream, this.CurrentUser, this.ModuleType, partyCode, timePeriodType, date);
            IList <OrderHead> ohList       = TheOrderMgr.ConvertFlowPlanToOrders(flowPlanList);
            if (ImportEvent != null)
            {
                ImportEvent(new object[] { ohList }, null);
            }
            ShowSuccessMessage("Import.Result.Successfully");
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }
Beispiel #24
0
    private IList <OrderHead> GetList()
    {
        IList <OrderHead> orderHeadList = new List <OrderHead>();

        foreach (GridViewRow gvr in GV_List.Rows)
        {
            string    flowCode   = ((Label)gvr.FindControl("lblFlow")).Text;
            DateTime  startTime  = DateTime.Parse(((TextBox)gvr.FindControl("tbStartTime")).Text);
            DateTime  windowTime = DateTime.Parse(((TextBox)gvr.FindControl("tbWindowTime")).Text);
            string    refOrderNo = ((HiddenField)gvr.FindControl("tbRefOrderNo")).Value;//客户参考订单号
            OrderHead oh         = new OrderHead();
            oh                  = TheOrderMgr.TransferFlow2Order(flowCode);
            oh.Priority         = BusinessConstants.CODE_MASTER_ORDER_PRIORITY_VALUE_NORMAL;
            oh.StartTime        = startTime;
            oh.WindowTime       = windowTime;
            oh.ReferenceOrderNo = refOrderNo;
            this.GetDetailControl(gvr).CollectData(oh);
            OrderHelper.FilterZeroOrderQty(oh);
            orderHeadList.Add(oh);
        }
        return(orderHeadList);
    }
Beispiel #25
0
 private void Import()
 {
     try
     {
         string   region    = this.tbRegion.Text.Trim() != string.Empty ? this.tbRegion.Text.Trim() : string.Empty;
         string   flowCode  = this.tbFlow.Text.Trim() != string.Empty ? this.tbFlow.Text.Trim() : string.Empty;
         DateTime date      = DateTime.Parse(this.tbDate.Text);
         string   shiftCode = this.ucShift.ShiftCode;
         decimal  leadTime  = decimal.Parse(this.tbLeadTime.Text.Trim());
         IList <ShiftPlanSchedule> spsList = TheImportMgr.ReadPSModelFromXls(fileUpload.PostedFile.InputStream, this.CurrentUser, region, flowCode, date, shiftCode);
         TheShiftPlanScheduleMgr.SaveShiftPlanSchedule(spsList, this.CurrentUser);
         IList <OrderHead> ohList = TheOrderMgr.ConvertShiftPlanScheduleToOrders(spsList, leadTime);
         if (ImportEvent != null)
         {
             ImportEvent(new object[] { ohList }, null);
         }
         ShowSuccessMessage("Import.Result.Successfully");
     }
     catch (BusinessErrorException ex)
     {
         ShowErrorMessage(ex);
     }
 }
    protected void lbtnOrder_Click(object sender, EventArgs e)
    {
        try
        {
            string    orderNo   = ((LinkButton)sender).CommandArgument;
            OrderHead orderHead = TheOrderMgr.LoadOrder(orderNo, this.CurrentUser);
            if (orderHead.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT)
            {
                TheOrderMgr.StartOrder(orderNo, this.CurrentUser);
            }
            List <string> orderNoList = new List <string>();
            orderNoList.Add(orderNo);


            if (EditEvent != null)
            {
                EditEvent(new Object[] { orderNoList }, e);
            }
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }
Beispiel #27
0
 protected void btnOrderNo_Click(object sender, EventArgs e)
 {
     TheOrderMgr.StartOrder(this.tbOrderNo.Text.Trim(), this.CurrentUser);
     this.gvOnline.DataBind();
 }
Beispiel #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;
            }
        }
    }
Beispiel #29
0
    public bool confirmRequisitionOrder(string requisitionOrderNo, string userCode)
    {
        TheOrderMgr.StartOrder(requisitionOrderNo, userCode);

        return(true);
    }
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        try
        {
            IList<TransformerDetail> transformerDetailList = this.ucList.PopulateTransformerDetailList();
            IList<OrderDetail> orderDetailList = new List<OrderDetail>();
            string currentFlow = string.Empty;

            foreach (TransformerDetail transformerDetail in transformerDetailList)
            {
                if (transformerDetail.CurrentQty != transformerDetail.AdjustQty)
                {
                    OrderLocationTransaction orderLocTrans = TheOrderLocationTransactionMgr.LoadOrderLocationTransaction(transformerDetail.OrderLocTransId);
                    if (currentFlow == string.Empty)
                    {
                        currentFlow = orderLocTrans.OrderDetail.OrderHead.Flow;
                    }
                    OrderDetail orderDetail = new OrderDetail();
                    orderDetail.Item = TheItemMgr.LoadItem(transformerDetail.ItemCode);
                    orderDetail.Uom = TheUomMgr.LoadUom(transformerDetail.UomCode);
                    if (transformerDetail.HuId != null && transformerDetail.HuId.Trim() != string.Empty)
                    {
                        Hu hu = this.TheHuMgr.CheckAndLoadHu(transformerDetail.HuId.Trim());
                        orderDetail.OrderedQty = transformerDetail.AdjustQty - hu.Qty;
                    }
                    else
                    {
                        orderDetail.OrderedQty = transformerDetail.AdjustQty - transformerDetail.CurrentQty;
                    }
                    orderDetail.UnitCount = transformerDetail.UnitCount;
                    orderDetail.HuId = transformerDetail.HuId;
                    orderDetail.HuLotNo = transformerDetail.LotNo;
                    if (transformerDetail.LocationFromCode != null)
                    {
                        orderDetail.LocationFrom = TheLocationMgr.LoadLocation(transformerDetail.LocationFromCode);
                    }
                    if (transformerDetail.LocationToCode != null)
                    {
                        orderDetail.LocationTo = TheLocationMgr.LoadLocation(transformerDetail.LocationToCode);

                    }

                    orderDetailList.Add(orderDetail);
                }
            }
            if (orderDetailList.Count > 0)
            {
                Receipt receipt = TheOrderMgr.QuickReceiveOrder(currentFlow, orderDetailList, this.CurrentUser.Code, BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_ADJ, DateTime.Now, DateTime.Now, false, this.ReceiptNo, null);
                this.Visible = false;
                ShowSuccessMessage("MasterData.Receipt.Adjust.Successfully", this.ReceiptNo);
                if (AdjustEvent != null)
                {
                    AdjustEvent(receipt.ReceiptNo, e);
                }
            }
            else
            {
                ShowSuccessMessage("MasterData.Receipt.NoDetail.Adjust", this.ReceiptNo);
            }
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }