Beispiel #1
0
    public bool updateRequisitionOrderPrintStatus(string requisitionOrderNo, string printStatus)
    {
        OrderHead orderHead = TheOrderHeadMgr.LoadOrderHead(requisitionOrderNo);

        orderHead.IsPrinted = printStatus == "Printed";
        TheOrderHeadMgr.UpdateOrderHead(orderHead);
        return(true);
    }
    private void AppendPrintUrlOrder(StringBuilder url, bool isWorkOrder)
    {
        DetachedCriteria criteria = DetachedCriteria.For(typeof(OrderHead));

        criteria.CreateAlias("PartyFrom", "pf");
        criteria.CreateAlias("PartyTo", "pt");

        criteria.Add(Expression.Eq("IsPrinted", false));

        OrderHelper.SetOpenOrderStatusCriteria(criteria, "Status");                               //订单状态
        SecurityHelper.SetPartySearchCriteria(criteria, "PartyFrom.Code", this.CurrentUser.Code); //区域或者供应商权限
        //SecurityHelper.SetRegionSearchCriteria(criteria, "PartyTo.Code", this.CurrentUser.Code); //区域权限
        if (isWorkOrder)
        {
            criteria.Add(Expression.Eq("Type", BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION));
        }
        else
        {
            criteria.Add(Expression.In("Type", new string[] {
                BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT,
                BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_TRANSFER
            }));
        }

        IList <OrderHead> orderHeadList = TheCriteriaMgr.FindAll <OrderHead>(criteria);

        if (orderHeadList != null && orderHeadList.Count > 0)
        {
            foreach (OrderHead orderHead in orderHeadList)
            {
                if (orderHead.OrderTemplate != null && orderHead.OrderTemplate.Trim() != string.Empty)
                {
                    string newUrl = TheReportMgr.WriteToFile(orderHead.OrderTemplate, orderHead.OrderNo);
                    AppendPrintUrl(url, newUrl);
                    orderHead.IsPrinted = true;//to be refactored
                    TheOrderHeadMgr.UpdateOrderHead(orderHead);
                }
            }
        }
    }