Пример #1
0
    protected void GV_List_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            object[] obj = (object[])e.Row.DataItem;

            ((Label)(e.Row.FindControl("lblSupplier"))).Text = ((Supplier)obj[0]).Code;
            ((Label)(e.Row.FindControl("lblItem"))).Text     = ((Item)obj[1]).Code;
            DetachedCriteria selectCriteria = DetachedCriteria.For(typeof(RollingForecast));
            selectCriteria.Add(Expression.Eq("Supplier.Code", ((Supplier)obj[0]).Code));
            selectCriteria.Add(Expression.Eq("Item.Code", ((Item)obj[1]).Code));
            selectCriteria.Add(Expression.Ge("Date", StartDate));
            selectCriteria.Add(Expression.Lt("Date", StartDate.AddDays(140)));

            IList <RollingForecast> rollingForecastList = TheCriteriaMgr.FindAll <RollingForecast>(selectCriteria);

            for (int i = 0; i < DateArr.Count(); i++)
            {
                var q = rollingForecastList.Where(f => f.Date.ToShortDateString() == DateArr[i].ToShortDateString()).OrderByDescending(p => p.CreateDate);
                if (q.Count() > 0)
                {
                    RollingForecast c = q.First();
                    ((Label)(e.Row.FindControl("lblQty" + i))).Text = c.Qty.ToString("0.########");
                }
            }
        }
    }
Пример #2
0
    public Billing[] getBilling(GetBillingRequest request)
    {
        DetachedCriteria criteria = DetachedCriteria.For <Bill>();

        if (request.orderby != null)
        {
            RequestOrderByHelper.ConverToCriteria(request.orderby, orderbyFiledsMapping, criteria);
        }

        IList <Bill>   billList    = TheCriteriaMgr.FindAll <Bill>(criteria, request.beginRowIndex, request.beginRowIndex + request.rowSize);
        List <Billing> billingList = new List <Billing>();

        foreach (Bill bill in billList)
        {
            Billing billing = fillBill(bill);
            foreach (BillDetail billDetail in bill.BillDetails)
            {
                BillingItem billingItem = fillBillDetail(billDetail);
                billing.AddBillingItem(billingItem);
            }
            billingList.Add(billing);
        }

        return(billingList.ToArray());
    }
Пример #3
0
    protected void tbItem_TextChanged(Object sender, EventArgs e)
    {
        try
        {
            if (this.tbItemCode.Text.Trim() != string.Empty)
            {
                DetachedCriteria criteria = DetachedCriteria.For(typeof(FlowDetail));
                criteria.CreateAlias("Flow", "f");
                //criteria.CreateAlias("f.PartyFrom", "fpf");
                //criteria.CreateAlias("f.PartyTo", "ftf");

                criteria.Add(Expression.Eq("Item.Code", this.tbItemCode.Text.Trim()));
                criteria.Add(Expression.Eq("f.IsActive", true));

                //#region partyFrom
                //SecurityHelper.SetPartySearchCriteria(criteria, "fpf.Code", this.CurrentUser.Code);
                //#endregion

                //#region partyTo
                //SecurityHelper.SetPartySearchCriteria(criteria, "ftf.Code", this.CurrentUser.Code);
                //#endregion

                IList <FlowDetail> flowDetailList = TheCriteriaMgr.FindAll <FlowDetail>(criteria);
                this.ucList.InitPageParameter(flowDetailList);
                this.ucList.Visible = true;
            }
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.tbFlowOrLoc.ServiceParameter = "string:" + this.CurrentUser.Code + ",bool:true,bool:true,bool:true,bool:true,bool:true,bool:true,string:" + BusinessConstants.PARTY_AUTHRIZE_OPTION_TO;

        this.tbFlowOrLoc.DataBind();
        this.tbFlow.ServiceParameter = "string:" + this.CurrentUser.Code + ",bool:true,bool:true,bool:true,bool:true,bool:true,bool:true,string:" + BusinessConstants.PARTY_AUTHRIZE_OPTION_TO;

        this.tbWinTime.Attributes.Add("onclick", "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',lang:'" + this.CurrentUser.UserLanguage + "'})");
        this.tbWinTime.Attributes["onchange"]  += "setStartTime();";
        this.cbIsUrgent.Attributes["onchange"] += "setStartTime();";
        if (!IsPostBack)
        {
            this.ucShift.Date = DateTime.Today;

            DetachedCriteria criteria = DetachedCriteria.For <MrpRunLog>();
            criteria.SetProjection(Projections.ProjectionList().Add(Projections.GroupProperty("RunDate")));
            criteria.AddOrder(Order.Desc("RunDate"));
            IList <DateTime> list = TheCriteriaMgr.FindAll <DateTime>(criteria, 0, 30);

            List <string> effDate = list.Select(l => l.ToString("yyyy-MM-dd")).ToList();

            this.ddlDate.DataSource = effDate;
            this.ddlDate.DataBind();
        }
    }
Пример #5
0
    protected void btnPickup_Click(object sender, EventArgs e)
    {
        try
        {
            //  ExecuteSubmit();
            DetachedCriteria criter = DetachedCriteria.For(typeof(LocationLotDetail));
            criter.Add(Expression.Eq("Location", TheLocationMgr.LoadLocation(tbMiscOrderLocation.Text)));
            criter.Add(Expression.In("StorageBin", TheStorageBinMgr.GetStorageBin(tbStorageBin.Text).ToList()));
            criter.Add(Expression.IsNotNull("StorageBin"));
            IList <LocationLotDetail> result = TheCriteriaMgr.FindAll <LocationLotDetail>(criter);
            foreach (LocationLotDetail lot in result)
            {
                lot.StorageBin    = null;
                lot.Hu.StorageBin = null;
                TheLocationLotDetailMgr.UpdateLocationLotDetail(lot);
            }

            ShowSuccessMessage("Warehouse.PickUp.Successfully");
            GridView1.DataSource = null;
            GridView1.DataBind();
            this.InitialAll();
        }
        catch (BusinessErrorException ex)
        {
            this.ShowErrorMessage(ex);
        }
    }
Пример #6
0
    private void AppendPrintUrlASN(StringBuilder url)
    {
        DetachedCriteria criteria = DetachedCriteria.For(typeof(InProcessLocation));

        criteria.Add(Expression.Eq("IsPrinted", false));
        criteria.Add(Expression.Eq("NeedPrintAsn", true));
        criteria.Add(Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE));
        criteria.Add(Expression.Eq("AsnTemplate", "ASN.xls"));
        criteria.Add(Expression.Or(Expression.Eq("OrderType", BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION),
                                   Expression.Eq("OrderType", BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_TRANSFER)));
        SecurityHelper.SetRegionSearchCriteria(criteria, "PartyFrom.Code", this.CurrentUser.Code); //区域权限

        IList <InProcessLocation> inProcessLocationList = TheCriteriaMgr.FindAll <InProcessLocation>(criteria);

        if (inProcessLocationList != null && inProcessLocationList.Count > 0)
        {
            foreach (InProcessLocation inProcessLocation in inProcessLocationList)
            {
                IList <object> list = new List <object>();
                list.Add(inProcessLocation);
                list.Add(inProcessLocation.InProcessLocationDetails);

                string printUrl = TheReportMgr.WriteToFile(inProcessLocation.AsnTemplate, list); //to be refactored
                AppendPrintUrl(url, printUrl);
                inProcessLocation.IsPrinted = true;                                              //to be refactored
                TheInProcessLocationMgr.UpdateInProcessLocation(inProcessLocation);
            }
        }
    }
Пример #7
0
    public int getSupplierInventoryCount(GetSupplierInventoryRequest request)
    {
        DetachedCriteria criteria = DetachedCriteria.For <SupllierLocationView>();


        if (request.supplierCode != null && request.supplierCode != string.Empty)
        {
            criteria.Add(Expression.Like("PartyFrom.Code", request.supplierCode));
        }

        if (request.company != null && request.company != string.Empty)
        {
            criteria.Add(Expression.Like("PartyFrom.Name", request.company));
        }

        IList list  = TheCriteriaMgr.FindAll(criteria);
        int   count = 0;

        if (list != null && list.Count > 0)
        {
            if (list[0] is int)
            {
                count = int.Parse(list[0].ToString());
            }
        }
        return(count);
    }
Пример #8
0
    public void InitPageParameter(DetachedCriteria criteria)
    {
        IList <PlannedBill> plannedBillList = TheCriteriaMgr.FindAll <PlannedBill>(criteria);

        this.MatchList = this.ConvertPlannedBillToTransformer(plannedBillList);
        this.BindList();
        this.tbItemCode.Focus();
    }
Пример #9
0
    public void BindDataSource(DetachedCriteria selectCriteria)
    {
        IList <PlannedBill> plannedBillList = TheCriteriaMgr.FindAll <PlannedBill>(selectCriteria);

        this.AutoCalculate(plannedBillList);
        this.GV_List.DataSource = plannedBillList;
        this.GV_List.DataBind();
        UpdateView();
    }
Пример #10
0
    protected override void DoSearch()
    {
        string pickListNo = this.tbPickListNo.Text != string.Empty ? this.tbPickListNo.Text.Trim() : string.Empty;
        string startDate  = this.tbStartDate.Text != string.Empty ? this.tbStartDate.Text.Trim() : string.Empty;
        string endDate    = this.tbEndDate.Text != string.Empty ? this.tbEndDate.Text.Trim() : string.Empty;


        DetachedCriteria selectCriteria = DetachedCriteria.For(typeof(PickList));

        selectCriteria.Add(Expression.Or(Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS),
                                         Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE)));
        selectCriteria.CreateAlias("PartyFrom", "pf");
        selectCriteria.CreateAlias("PartyTo", "pt");


        //partyFrom
        DetachedCriteria[] pfCrieteria = SecurityHelper.GetPartyPermissionCriteria(this.CurrentUser.Code,
                                                                                   BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_REGION);

        selectCriteria.Add(
            Expression.Or(
                Subqueries.PropertyIn("pf.Code", pfCrieteria[0]),
                Subqueries.PropertyIn("pf.Code", pfCrieteria[1])
                ));

        ////partyTo
        //DetachedCriteria[] ptCrieteria = SecurityHelper.GetPartyPermissionCriteria(this.CurrentUser.Code,
        //          BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_REGION, BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_CUSTOMER);

        //selectCriteria.Add(
        //    Expression.Or(
        //        Subqueries.PropertyIn("pt.Code", ptCrieteria[0]),
        //        Subqueries.PropertyIn("pt.Code", ptCrieteria[1])
        //));

        if (pickListNo != string.Empty)
        {
            selectCriteria.Add(Expression.Eq("PickListNo", pickListNo));
        }

        if (startDate != string.Empty)
        {
            selectCriteria.Add(Expression.Ge("CreateDate", DateTime.Parse(startDate)));
        }
        if (endDate != string.Empty)
        {
            selectCriteria.Add(Expression.Lt("CreateDate", DateTime.Parse(endDate).AddDays(1)));
        }

        IList <PickList> pickList = TheCriteriaMgr.FindAll <PickList>(selectCriteria);


        this.ucList.BindDataSource(pickList);
        this.ucList.Visible = true;
    }
Пример #11
0
    public void BindDataSource(DetachedCriteria selectCriteria, bool isExport)
    {
        IList <PlannedBill> plannedBills = TheCriteriaMgr.FindAll <PlannedBill>(selectCriteria);

        if (IsSupplier)
        {
            plannedBills = (from p in plannedBills
                            group p by new { p.Item, p.OrderNo, p.ReceiptNo, p.BillAddress, p.Uom, p.CreateDate, p.UnitPrice, p.Currency } into g
                            select new PlannedBill
            {
                Item = g.Key.Item,
                OrderNo = g.Key.OrderNo,
                ReceiptNo = g.Key.ReceiptNo,
                BillAddress = g.Key.BillAddress,
                Uom = g.Key.Uom,
                CreateDate = g.Key.CreateDate,
                UnitPrice = g.Key.UnitPrice,
                Currency = g.Key.Currency,
                PlannedQty = g.Sum(p => p.PlannedQty),
                PlannedAmount = g.Sum(p => p.PlannedAmount),
                ActingQty = g.Sum(p => p.ActingQty),
                ActingAmount = g.Sum(p => p.ActingAmount)
            })
                           //.Where(p => this.CurrentUser.HasPermission(p.BillAddress.Party.Code))
                           .ToList();
        }
        plannedBills            = plannedBills.OrderBy(p => p.CreateDate).OrderBy(p => p.Item.Code).ToList();
        this.GV_List.DataSource = plannedBills;
        this.GV_List.DataBind();
        UpdateView();
        if (isExport && GV_List.Rows.Count > 0)
        {
            string           dateTime          = DateTime.Now.ToString("MMddhhmmss");
            int              lastColumnIndex   = GV_List.Columns.Count - 1;
            DataControlField dataControlField0 = null;
            //DataControlField dataControlFieldLast = null;
            if (!IsSupplier)
            {
                dataControlField0 = GV_List.Columns[0];
                //dataControlFieldLast = GV_List.Columns[lastColumnIndex];
                //GV_List.Columns.RemoveAt(lastColumnIndex);
                GV_List.Columns.RemoveAt(0);
            }

            this.ExportXLS(GV_List, "PlanBill" + dateTime + ".xls");

            if (!IsSupplier)
            {
                GV_List.Columns.Insert(0, dataControlField0);
                //GV_List.Columns.Insert(lastColumnIndex-1, dataControlFieldLast);
            }
        }
    }
Пример #12
0
    private void BindLocation()
    {
        DetachedCriteria selectCriteria = DetachedCriteria.For(typeof(Location));

        selectCriteria.Add(Expression.Eq("Type", "11"));
        SecurityHelper.SetPartySearchCriteria(selectCriteria, "Region", this.CurrentUser.Code);
        IList <Location> locationList = TheCriteriaMgr.FindAll <Location>(selectCriteria);

        locationList.Add(TheLocationMgr.GetRejectLocation());
        this.ddlLocationFrom.DataSource = locationList;
        this.ddlLocationFrom.DataBind();
    }
Пример #13
0
    public void InitPageParameter(string flowCode)
    {
        this.FlowCode = flowCode;
        DetachedCriteria selectCriteria = DetachedCriteria.For(typeof(OrderHead));

        selectCriteria.Add(Expression.Eq("Flow", flowCode))
        .Add(Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT));
        IList <OrderHead> orderHeadList = TheCriteriaMgr.FindAll <OrderHead>(selectCriteria);

        this.GV_List.DataSource = orderHeadList;
        this.GV_List.DataBind();
    }
Пример #14
0
    private void SumQty()
    {
        DetachedCriteria criteria = this.GetCriteria();

        criteria.SetProjection(Projections.Sum("Qty"));

        IList result = TheCriteriaMgr.FindAll(criteria);

        if (result[0] != null)
        {
            this.Text = ((decimal)result[0]).ToString("0.########");
        }
    }
Пример #15
0
    public int getReceivingNoteCount(GetReceivingNoteRequest request)
    {
        DetachedCriteria criteria = DetachedCriteria.For <Receipt>().SetProjection(Projections.ProjectionList()
                                                                                   .Add(Projections.Count("ReceiptNo")));

        if (request.supplier != null && request.supplier != string.Empty)
        {
            criteria.Add(Expression.Like("PartyFrom.Name", request.supplier));
        }
        if (request.supplierPartyCode != null && request.supplierPartyCode != string.Empty)
        {
            criteria.Add(Expression.Eq("PartyFrom.Code", request.supplierPartyCode));
        }
        if (request.customerPartyCode != null && request.customerPartyCode != string.Empty)
        {
            criteria.Add(Expression.Eq("PartyTo.Code", request.customerPartyCode));
        }

        if (request.customer != null && request.customer != string.Empty)
        {
            criteria.Add(Expression.Like("PartyTo.Name", request.customer));
        }

        if (request.receivingNo != null && request.receivingNo != string.Empty)
        {
            criteria.Add(Expression.Eq("ReceiptNo", request.receivingNo));
        }

        if (request.receiveDateFromSpecified)
        {
            criteria.Add(Expression.Ge("CreateDate", request.receiveDateFrom));
        }

        if (request.receiveDateToSpecified)
        {
            criteria.Add(Expression.Le("CreateDate", request.receiveDateTo));
        }

        IList list = TheCriteriaMgr.FindAll(criteria, request.beginRowIndex, request.beginRowIndex + request.rowSize);

        int count = 0;

        if (list != null && list.Count > 0)
        {
            if (list[0] is int)
            {
                count = int.Parse(list[0].ToString());
            }
        }
        return(count);
    }
Пример #16
0
    protected void LoadItem(object sender, EventArgs e)
    {
        DetachedCriteria criter = DetachedCriteria.For(typeof(LocationLotDetail));

        criter.Add(Expression.Eq("Location", TheLocationMgr.LoadLocation(tbMiscOrderLocation.Text)));
        criter.Add(Expression.In("StorageBin", TheStorageBinMgr.GetStorageBin(tbStorageBin.Text).ToList()));
        criter.Add(Expression.IsNotNull("StorageBin"));
        IList <LocationLotDetail> result = TheCriteriaMgr.FindAll <LocationLotDetail>(criter);



        GridView1.DataSource = result;
        GridView1.DataBind();
    }
Пример #17
0
    public ReceivingNoteItem[] getReceivingNoteDetail(GetReceivingNoteDetailRequest request)
    {
        DetachedCriteria criteria = DetachedCriteria.For <ReceiptDetail>();

        criteria.Add(Expression.Eq("ReceiptNo", request.receivingNo));
        IList <ReceiptDetail>    reciptDetailList      = TheCriteriaMgr.FindAll <ReceiptDetail>(criteria);
        List <ReceivingNoteItem> receivingNoteItemList = new List <ReceivingNoteItem>();

        foreach (ReceiptDetail receiptDetail in reciptDetailList)
        {
            ReceivingNoteItem item = new ReceivingNoteItem();

            //set unit of messure
            UOM uom = new UOM();
            uom.id           = receiptDetail.OrderLocationTransaction.Item.Uom.Code;
            uom.abbreviation = receiptDetail.OrderLocationTransaction.Item.Uom.Name;
            uom.description  = receiptDetail.OrderLocationTransaction.Item.Uom.Name;

            //set supplier Item
            Material suppItem = new Material();
            suppItem.id          = receiptDetail.OrderLocationTransaction.OrderDetail.ReferenceItemCode;
            suppItem.no          = receiptDetail.OrderLocationTransaction.OrderDetail.ReferenceItemCode;
            suppItem.description = receiptDetail.OrderLocationTransaction.OrderDetail.ReferenceItemCode;
            suppItem.quantityUOM = uom;

            //set Item
            Material material = new Material();
            material.id          = receiptDetail.OrderLocationTransaction.Item.Code;
            material.no          = receiptDetail.OrderLocationTransaction.Item.Code;
            material.name        = receiptDetail.OrderLocationTransaction.Item.Description;
            material.description = receiptDetail.OrderLocationTransaction.Item.Description;
            material.quantityUOM = uom;

            item.material = material;


            item.receiveQuantity          = Convert.ToDouble(receiptDetail.ReceivedQty);
            item.receiveQuantitySpecified = true;

            //不知道怎么取
            item.totalBillingQuantity          = Convert.ToDouble(receiptDetail.ReceivedQty);
            item.totalBillingQuantitySpecified = true;
            item.billingStatus = string.Empty;

            item.unitCount          = Convert.ToDouble(receiptDetail.OrderLocationTransaction.OrderDetail.UnitCount);
            item.unitCountSpecified = true;
        }
        return(null);
    }
Пример #18
0
    public void InitPageParameter(object sender)
    {
        this.Param = (object[])sender;
        string location = (string)Param[0];
        string area     = (string)Param[1];
        string bin      = (string)Param[2];
        string item     = (string)Param[3];
        string huId     = (string)Param[4];
        string lotNo    = (string)Param[5];

        #region DetachedCriteria
        DetachedCriteria selectCriteria      = DetachedCriteria.For(typeof(LocationBin));
        DetachedCriteria selectCountCriteria = DetachedCriteria.For(typeof(LocationBin))
                                               .SetProjection(Projections.Count("Id"));

        //区域权限
        SecurityHelper.SetRegionSearchCriteria(selectCriteria, selectCountCriteria, "Region", this.CurrentUser.Code);

        if (location != string.Empty)
        {
            selectCriteria.Add(Expression.Eq("Location", location));
            selectCountCriteria.Add(Expression.Eq("Location", location));
            this.GV_List.Columns[0].Visible = false;
            this.GV_List.Columns[1].Visible = false;
        }
        else
        {
            this.GV_List.Columns[0].Visible = true;
            this.GV_List.Columns[1].Visible = true;
        }
        if (area != string.Empty)
        {
            selectCriteria.Add(Expression.Eq("Area", area));
            selectCountCriteria.Add(Expression.Eq("Area", area));
        }
        if (bin != string.Empty)
        {
            selectCriteria.Add(Expression.Eq("Bin", bin));
            selectCountCriteria.Add(Expression.Eq("Bin", bin));
        }

        #endregion

        IList <LocationBin> locationBinList = TheCriteriaMgr.FindAll <LocationBin>(selectCriteria);
        this.GV_List.DataSource = locationBinList;
        this.GV_List.DataBind();
    }
Пример #19
0
    public void InitPageParameter(DetachedCriteria selectCriteria)
    {
        this.InspectCriteria = selectCriteria;
        IList <InspectOrderDetail> pendingInspectOrderDetailList = TheCriteriaMgr.FindAll <InspectOrderDetail>(selectCriteria);

        this.GV_List.DataSource = pendingInspectOrderDetailList;
        this.GV_List.DataBind();
        if (pendingInspectOrderDetailList.Count == 0)
        {
            this.lblMessage.Visible = true;
            this.lblMessage.Text    = "${Common.GridView.NoRecordFound}";
        }
        else
        {
            this.lblMessage.Visible = false;
        }
    }
Пример #20
0
    public int getBillingCount(GetBillingRequest request)
    {
        DetachedCriteria criteria = DetachedCriteria.For <Bill>().SetProjection(Projections.ProjectionList()
                                                                                .Add(Projections.Count("OrderNo")));

        IList list = TheCriteriaMgr.FindAll(criteria, request.beginRowIndex, request.beginRowIndex + request.rowSize);

        int count = 0;

        if (list != null && list.Count > 0)
        {
            if (list[0] is int)
            {
                count = int.Parse(list[0].ToString());
            }
        }
        return(count);
    }
Пример #21
0
    public void InitPageParameter(DetachedCriteria selectCriteria)
    {
        IList <InspectResult> unqualifiedGoodsList = TheCriteriaMgr.FindAll <InspectResult>(selectCriteria);

        this.GV_List.DataSource = unqualifiedGoodsList;
        this.GV_List.DataBind();
        if (unqualifiedGoodsList.Count == 0)
        {
            this.lblMessage.Visible = true;
            this.lblMessage.Text    = "${Common.GridView.NoRecordFound}";
            this.btnPrint.Visible   = false;
        }
        else
        {
            this.lblMessage.Visible = false;
            this.btnPrint.Visible   = true;
        }
    }
Пример #22
0
    public void InitPageParameter(DetachedCriteria selectCriteria)
    {
        IList <OrderHead> orderHeadList = TheCriteriaMgr.FindAll <OrderHead>(selectCriteria);

        this.GV_List.DataSource = orderHeadList;
        this.GV_List.DataBind();
        if (orderHeadList.Count == 0)
        {
            this.lblMessage.Visible = true;
            this.lblMessage.Text    = "${Common.GridView.NoRecordFound}";
            this.btnPrint.Visible   = false;
        }
        else
        {
            this.lblMessage.Visible = false;
            this.btnPrint.Visible   = true;
        }
    }
Пример #23
0
    public int getReceivingNoteDetailCount(GetReceivingNoteDetailRequest requset)
    {
        DetachedCriteria criteria = DetachedCriteria.For <ReceiptDetail>().SetProjection(Projections.ProjectionList()
                                                                                         .Add(Projections.Count("ReceiptNo")));

        IList list = TheCriteriaMgr.FindAll(criteria);

        int count = 0;

        if (list != null && list.Count > 0)
        {
            if (list[0] is int)
            {
                count = int.Parse(list[0].ToString());
            }
        }

        return(count);
    }
Пример #24
0
    protected void lbtnQty_Click(object sender, EventArgs e)
    {
        string flowItem = ((LinkButton)sender).CommandArgument;

        string[] argument = flowItem.Split('|');
        string   flow     = argument[0];
        string   item     = argument[1];

        DetachedCriteria criteria = CloneHelper.DeepClone <DetachedCriteria>(this.DetailCriteria);

        criteria.Add(Expression.Eq("Item", item));
        criteria.Add(Expression.Eq("Flow", flow));



        IList <WoReceiptView> woReceiptDetailList = TheCriteriaMgr.FindAll <WoReceiptView>(criteria);

        this.ucList.UpdateView(woReceiptDetailList);
        this.ucList.Visible = true;
    }
    public IList <InspectResult> PopulateUnqualifiedInspectOrder()
    {
        DetachedCriteria maxRecCriteria = DetachedCriteria.For(typeof(InspectResult));

        maxRecCriteria.CreateAlias("InspectOrderDetail", "id");
        maxRecCriteria.CreateAlias("id.InspectOrder", "i");
        maxRecCriteria.Add(Expression.Eq("i.InspectNo", this.InspectNo));
        maxRecCriteria.Add(Expression.IsNotNull("RejectedQty"));
        maxRecCriteria.Add(Expression.Gt("RejectedQty", decimal.Zero));
        maxRecCriteria.SetProjection(Projections.ProjectionList().Add(Projections.Max("InspectResultNo").As("InspectResultNo")));

        DetachedCriteria selectCriteria = DetachedCriteria.For(typeof(InspectResult));

        selectCriteria.CreateAlias("InspectOrderDetail", "id");
        selectCriteria.CreateAlias("id.InspectOrder", "i");
        selectCriteria.Add(Expression.Eq("i.InspectNo", this.InspectNo));
        selectCriteria.Add(Subqueries.PropertyIn("InspectResultNo", maxRecCriteria));


        return(TheCriteriaMgr.FindAll <InspectResult>(selectCriteria));
    }
Пример #26
0
    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);
                }
            }
        }
    }
Пример #27
0
 protected void btnConfirm_Click(object sender, EventArgs e)
 {
     if (IpNo.Text != string.Empty)
     {
         IList <InProcessLocation> ipl = new List <InProcessLocation>();
         if (Session["IpList"] != null)
         {
             ipl = (IList <InProcessLocation>)Session["IpList"];
         }
         DetachedCriteria selectCriteria = DetachedCriteria.For(typeof(InProcessLocation));
         selectCriteria.Add(Expression.Like("IpNo", IpNo.Text.Trim(), MatchMode.End));
         selectCriteria.Add(Expression.Eq("PartyFrom.Code", "YFK-FG"));
         IList <InProcessLocation> result = TheCriteriaMgr.FindAll <InProcessLocation>(selectCriteria);
         if (result.Count == 0)
         {
             ShowWarningMessage("InProcessLocation.UnLoad.Warning", IpNo.Text.Trim());
         }
         int cnt = ipl.Count;
         foreach (InProcessLocation i in result)
         {
             if (checkIsExist(ipl, i.IpNo) == true)
             {
                 continue;
             }
             if (i.CurrentActivity == null)
             {
                 ipl.Add(i);
             }
         }
         if (cnt == ipl.Count)
         {
             ShowWarningMessage("InProcessLocation.UnLoad.Warning", IpNo.Text.Trim());
         }
         GV_List.DataSource = ipl;
         GV_List.DataBind();
         Session["IpList"] = ipl;
         TheCriteriaMgr.CleanSession();
     }
 }
Пример #28
0
    public void InitPageParameter(string flowCode, string orderSubType)
    {
        this.ModuleSubType = orderSubType;

        DetachedCriteria selectCriteria = DetachedCriteria.For(typeof(OrderHead));

        selectCriteria.Add(Expression.Eq("Flow", flowCode))
        .Add(Expression.Or(Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS),
                           Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT)))
        .Add(Expression.Eq("SubType", this.ModuleSubType))
        .AddOrder(Order.Asc("WindowTime")).AddOrder(Order.Asc("StartTime"));
        IList <OrderHead> orderList     = new List <OrderHead>();
        IList <OrderHead> orderHeadList = TheCriteriaMgr.FindAll <OrderHead>(selectCriteria);

        foreach (OrderHead orderHead in orderHeadList)
        {
            IList <OrderDetail> orderDetailList = orderHead.OrderDetails;
            if (orderHead.OrderDetails.Count > 0)
            {
                foreach (OrderDetail orderDetail in orderHead.OrderDetails)
                {
                    if (orderDetail.RemainShippedQty > 0)
                    {
                        orderList.Add(orderHead);
                        break;
                    }
                }
            }
        }

        if (orderList.Count > 0)
        {
            this.OrderType = orderList[0].Type;


            this.GV_List.DataSource = orderList;
            this.GV_List.DataBind();
        }
    }
Пример #29
0
    private void AppendPrintUrlInspectionOrder(StringBuilder url)
    {
        DetachedCriteria criteria = DetachedCriteria.For(typeof(InspectOrder));

        criteria.Add(Expression.Eq("IsPrinted", false));
        criteria.Add(Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE));
        //SecurityHelper.SetRegionSearchCriteria(criteria, "PartyFrom.Code", this.CurrentUser.Code); //区域权限
        //SecurityHelper.SetRegionSearchCriteria(criteria, "PartyTo.Code", this.CurrentUser.Code); //区域权限

        IList <InspectOrder> inspectOrderList = TheCriteriaMgr.FindAll <InspectOrder>(criteria);

        if (inspectOrderList != null && inspectOrderList.Count > 0)
        {
            foreach (InspectOrder inspectOrder in inspectOrderList)
            {
                string newUrl = TheReportMgr.WriteToFile("InspectOrder.xls", inspectOrder.InspectNo); //to be refactored
                AppendPrintUrl(url, newUrl);
                inspectOrder.IsPrinted = true;                                                        //to be refactored
                TheInspectOrderMgr.UpdateInspectOrder(inspectOrder);
            }
        }
    }
Пример #30
0
    private void AppendPrintUrlPicklist(StringBuilder url)
    {
        DetachedCriteria criteria = DetachedCriteria.For(typeof(PickList));

        criteria.Add(Expression.Eq("IsPrinted", false));
        OrderHelper.SetOpenOrderStatusCriteria(criteria, "Status");                                //订单状态
        SecurityHelper.SetRegionSearchCriteria(criteria, "PartyFrom.Code", this.CurrentUser.Code); //区域权限
        //SecurityHelper.SetRegionSearchCriteria(criteria, "PartyTo.Code", this.CurrentUser.Code); //区域权限

        IList <PickList> pickList = TheCriteriaMgr.FindAll <PickList>(criteria);

        if (pickList != null && pickList.Count > 0)
        {
            foreach (PickList pl in pickList)
            {
                string newUrl = TheReportMgr.WriteToFile("PickList.xls", pl.PickListNo); //to be refactored
                AppendPrintUrl(url, newUrl);
                pl.IsPrinted = true;                                                     //to be refactored
                ThePickListMgr.UpdatePickList(pl);
            }
        }
    }