Esempio n. 1
0
    protected void btnPrint_Click(object sender, EventArgs e)
    {
        IList <ReceiptDetail> receiptDetailList = PopulateReceiptDetail();

        if (receiptDetailList == null || receiptDetailList.Count == 0)
        {
            this.ShowErrorMessage("Inventory.Error.PrintHu.ReceiptDetail.Required");
            return;
        }

        string huTemplate = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_HU_TEMPLATE).Value;

        if (receiptDetailList != null &&
            receiptDetailList.Count > 0 &&
            huTemplate != null &&
            huTemplate.Length > 0)
        {
            IList <Hu> huList = new List <Hu>();
            foreach (ReceiptDetail receiptDetail in receiptDetailList)
            {
                huList.Add(TheHuMgr.LoadHu(receiptDetail.HuId));
            }

            IList <object> huDetailObj = new List <object>();

            huDetailObj.Add(huList);
            huDetailObj.Add(CurrentUser.Code);
            //receiptDetailList[0].Receipt.HuTemplate
            string barCodeUrl = TheReportMgr.WriteToFile(huTemplate, huDetailObj, huTemplate);

            Page.ClientScript.RegisterStartupScript(GetType(), "method", " <script language='javascript' type='text/javascript'>PrintOrder('" + barCodeUrl + "'); </script>");

            this.ShowSuccessMessage("Inventory.PrintHu.Successful");
        }
    }
Esempio n. 2
0
    public void PrintCallBack()
    {
        if (this.GV_List.Rows != null && this.GV_List.Rows.Count > 0)
        {
            IList <Hu> huList = new List <Hu>();

            foreach (GridViewRow row in this.GV_List.Rows)
            {
                CheckBox checkBoxGroup = row.FindControl("CheckBoxGroup") as CheckBox;
                if (checkBoxGroup.Checked)
                {
                    HiddenField hfHuId = row.FindControl("hfHuId") as HiddenField;

                    Hu hu = TheHuMgr.LoadHu(hfHuId.Value);
                    huList.Add(hu);
                }
            }

            this.PrintEvent(huList, null);

            return;
        }

        this.PrintEvent(null, null);
    }
Esempio n. 3
0
    private void HuScan(string huId)
    {
        Hu hu = TheHuMgr.LoadHu(huId);

        if (hu != null)
        {
            this.HuScan(hu);
        }
        else
        {
            ShowErrorMessage("Hu.Not.Exist");
            this.InitialHuScan();
            return;
        }
    }
Esempio n. 4
0
    private void HuInput(string huId)
    {
        try
        {
            if (MiscOrder.MiscOrderDetails != null)
            {
                foreach (MiscOrderDetail miscOrderDetail in MiscOrder.MiscOrderDetails)
                {
                    if (miscOrderDetail.HuId == huId)
                    {
                        ShowErrorMessage("MasterData.MiscOrder.Location.Exists");
                    }
                }
            }
            if (this.ModuleType != BusinessConstants.CODE_MASTER_MISC_ORDER_TYPE_VALUE_GR)
            {
                if (this.tbMiscOrderLocation.Text.Trim() == string.Empty)
                {
                    ShowErrorMessage("MasterData.MiscOrder.Location.Empty");
                    return;
                }
                IList <LocationLotDetail> locationLotDetailList = TheLocationLotDetailMgr.GetHuLocationLotDetail(this.tbMiscOrderLocation.Text.Trim(), huId);
                if (locationLotDetailList.Count == 0)
                {
                    ShowErrorMessage("MasterData.MiscOrder.Location.NotExists.Hu", huId);
                }
            }
            Hu hu = TheHuMgr.LoadHu(huId);
            MiscOrderDetail newMiscOrderDetail = new MiscOrderDetail();
            newMiscOrderDetail.HuId  = huId;
            newMiscOrderDetail.Item  = hu.Item;
            newMiscOrderDetail.LotNo = hu.LotNo;
            newMiscOrderDetail.Qty   = hu.Qty * hu.UnitQty;
            MiscOrder.AddMiscOrderDetail(newMiscOrderDetail);

            BindMiscOrderDetails();
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        decimal    unitCount = decimal.Parse(this.tbUnitCount.Text.Trim());
        int        count     = int.Parse(this.tbQty.Text.Trim());
        IList <Hu> huList    = TheHuMgr.CloneHu(HuId, unitCount, count, this.CurrentUser);

        IList <object> huDetailObj = new List <object>();

        huDetailObj.Add(huList);
        huDetailObj.Add(CurrentUser.Code);

        string huTemplate = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_HU_TEMPLATE).Value;

        if (huTemplate != null && huTemplate.Length > 0)
        {
            string barCodeUrl = TheReportMgr.WriteToFile(huTemplate, huDetailObj, "BarCode.xls");
            Page.ClientScript.RegisterStartupScript(GetType(), "method", " <script language='javascript' type='text/javascript'>PrintOrder('" + barCodeUrl + "'); </script>");
            this.ShowSuccessMessage("Inventory.PrintHu.Successful");
        }
    }
Esempio n. 6
0
    protected void tbHuId_TextChanged(object sender, EventArgs e)
    {
        this.lblMessage.Text = string.Empty;

        TextBox    _editControl = (TextBox)sender;
        string     huId         = _editControl.Text.Trim().ToUpper();
        IList <Hu> huList       = this.GetHuList();
        Hu         hu           = TheHuMgr.LoadHu(huId);

        if (hu != null && huList.IndexOf(hu) < 0)
        {
            huList.Add(hu);
        }
        else
        {
            this.lblMessage.Text = Resources.Language.MasterDataHuNotExist + " (" + huId + ")";
        }

        this.InitialHuIdInput(huList);
    }
Esempio n. 7
0
 protected void GV_List_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         PickListDetail         pickListDetail     = (PickListDetail)e.Row.DataItem;
         Hu_HuInput             ucHuInput          = (Hu_HuInput)e.Row.FindControl("ucHuInput");
         TextBox                tbShipQty          = (TextBox)e.Row.FindControl("tbShipQty");
         IList <PickListResult> pickListResultList = ThePickListResultMgr.GetPickListResult(pickListDetail);
         if (pickListResultList != null && pickListResultList.Count > 0)
         {
             foreach (PickListResult pickListResult in pickListResultList)
             {
                 string huId  = pickListResult.LocationLotDetail.Hu.HuId;
                 Hu     newHu = TheHuMgr.LoadHu(huId);
                 newHu.Qty = pickListResult.Qty;
                 ucHuInput.HuInput(newHu);
                 tbShipQty.Text = ucHuInput.SumQty().ToString("F2");
             }
         }
     }
 }
Esempio n. 8
0
    private IList <Hu> GetHuList()
    {
        IList <Hu> huList = new List <Hu>();

        foreach (GridViewRow gvr in GV_List.Rows)
        {
            Label _displayControl = (Label)gvr.FindControl("lblHuId");

            string huId = string.Empty;
            if (_displayControl.Visible)
            {
                huId = _displayControl.Text.Trim();
                Hu hu = TheHuMgr.LoadHu(huId);
                if (hu != null)
                {
                    huList.Add(hu);
                }
            }
        }

        return(huList);
    }
Esempio n. 9
0
    private void HuScan(string huId)
    {
        Hu hu = TheHuMgr.LoadHu(huId);

        HuScan(hu);
    }
    protected void btnRepack_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.RepackType == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_REPACK)
            {
                if (this.IsQty)
                {
                    if (this.tbLocation.Text.Trim() == string.Empty)
                    {
                        ShowErrorMessage("MasterData.Inventory.Repack.Location.Empty");
                        return;
                    }

                    if (this.OutTransformerDetailList == null || this.OutTransformerDetailList.Count == 0)
                    {
                        ShowErrorMessage("MasterData.Inventory.Repack.Error.RepackDetailEmpty");
                        return;
                    }

                    IList <RepackDetail> repackDetailList = new List <RepackDetail>();


                    IDictionary <string, decimal> ItemDic = new Dictionary <string, decimal>();

                    foreach (TransformerDetail transformerDetail in OutTransformerDetailList)
                    {
                        RepackDetail outRepackDetail = new RepackDetail();

                        outRepackDetail.IOType = BusinessConstants.IO_TYPE_OUT;

                        outRepackDetail.Hu  = TheHuMgr.LoadHu(transformerDetail.HuId);
                        outRepackDetail.Qty = outRepackDetail.Hu.Qty * outRepackDetail.Hu.UnitQty;

                        if (ItemDic.ContainsKey(outRepackDetail.Hu.Item.Code))
                        {
                            ItemDic[outRepackDetail.Hu.Item.Code] += outRepackDetail.Qty;
                        }
                        else
                        {
                            ItemDic.Add(outRepackDetail.Hu.Item.Code, outRepackDetail.Qty);
                        }
                        repackDetailList.Add(outRepackDetail);
                    }
                    if (repackDetailList.Count > 0)
                    {
                        foreach (string item in ItemDic.Keys)
                        {
                            IList <LocationLotDetail> locationLotDetailList = TheLocationLotDetailMgr.GetLocationLotDetail(this.tbLocation.Text.Trim(), item, false, false, BusinessConstants.PLUS_INVENTORY, null, false);
                            if (locationLotDetailList == null || locationLotDetailList.Count == 0)
                            {
                                ShowErrorMessage("MasterData.Inventory.Repack.LocationLotDetail.Empty");
                                return;
                            }

                            decimal locQty = (from l in locationLotDetailList select l.Qty).Sum();
                            decimal outQty = ItemDic[item];
                            if (outQty > locQty)
                            {
                                ShowErrorMessage("MasterData.Inventory.LocationLotDetail.LessThanHuQty", item, locQty.ToString("0.########"), outQty.ToString("0.########"));
                                return;
                            }

                            foreach (LocationLotDetail locationLotDetail in locationLotDetailList)
                            {
                                RepackDetail inRepackDetail = new RepackDetail();
                                inRepackDetail.LocationLotDetail = locationLotDetail;
                                inRepackDetail.IOType            = BusinessConstants.IO_TYPE_IN;
                                repackDetailList.Add(inRepackDetail);
                                if (locationLotDetail.Qty < outQty)
                                {
                                    inRepackDetail.Qty = locationLotDetail.Qty;
                                    outQty            -= inRepackDetail.Qty;
                                }
                                else
                                {
                                    inRepackDetail.Qty = outQty;
                                    break;
                                }
                            }
                        }
                    }


                    Repack repack = TheRepackMgr.CreateRepack(repackDetailList, this.CurrentUser);

                    if (this.IsQty)
                    {
                        RepackEvent(repack.RepackNo, e);
                    }
                }
                else
                {
                    ExecuteSubmit();
                    Repack     repack = TheRepackMgr.LoadRepack(this.CacheResolver.Code, true);
                    IList <Hu> huList = new List <Hu>();
                    foreach (RepackDetail repackDet in repack.RepackDetails)
                    {
                        if (repackDet.IOType == BusinessConstants.IO_TYPE_OUT && repackDet.LocationLotDetail.Hu != null &&
                            repackDet.LocationLotDetail.Hu.PrintCount == 0)
                        {
                            huList.Add(repackDet.LocationLotDetail.Hu);
                        }
                    }

                    if (huList.Count > 0)
                    {
                        IList <object> huDetailObj = new List <object>();

                        huDetailObj.Add(huList);
                        huDetailObj.Add(CurrentUser.Code);
                        string huTemplate = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_HU_TEMPLATE).Value;
                        if (huTemplate != null && huTemplate.Length > 0)
                        {
                            string barCodeUrl = TheReportMgr.WriteToFile(huTemplate, huDetailObj, "BarCode.xls");
                            Page.ClientScript.RegisterStartupScript(GetType(), "method", " <script language='javascript' type='text/javascript'>PrintOrder('" + barCodeUrl + "'); </script>");
                        }
                    }
                }
            }
            else if (this.RepackType == BusinessConstants.CODE_MASTER_REPACK_TYPE_VALUE_DEVANNING)
            {
                UpdateOutTransformer();
                ExecuteSubmit();
            }
            if (RepackEvent != null && !this.IsQty)
            {
                RepackEvent(this.CacheResolver.Code, e);
            }
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }
    protected void btnPrint_Click(object sender, EventArgs e)
    {
        IList <OrderDetail> orderDetailList       = PopulateOrderDetailList();
        IList <OrderDetail> targetOrderDetailList = new List <OrderDetail>();

        if (orderDetailList != null && orderDetailList.Count > 0)
        {
            foreach (OrderDetail orderDetail in orderDetailList)
            {
                if (orderDetail.OrderedQty > 0)
                {
                    targetOrderDetailList.Add(orderDetail);
                }
            }
        }

        if (targetOrderDetailList.Count == 0)
        {
            this.ShowErrorMessage("Inventory.Error.PrintHu.OrderDetail.Required");
            return;
        }

        IList <Hu> huList = null;

        #region  内/外包装
        string          packageType    = null;
        RadioButtonList rblPackageType = (RadioButtonList)this.Parent.FindControl("rblPackageType");
        if (rblPackageType.SelectedValue == "0")
        {
            packageType = BusinessConstants.CODE_MASTER_PACKAGETYPE_INNER;
        }
        else if (rblPackageType.SelectedValue == "1")
        {
            packageType = BusinessConstants.CODE_MASTER_PACKAGETYPE_OUTER;
        }
        #endregion
        if (this.ModuleType == BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_SUPPLIER)
        {
            huList = TheHuMgr.CreateHu(targetOrderDetailList, this.CurrentUser, null, packageType);
        }
        else
        {
            EntityPreference entityPreference = this.TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_COMPANY_ID_MARK);
            huList = TheHuMgr.CreateHu(targetOrderDetailList, this.CurrentUser, entityPreference.Value, packageType);
        }

        String huTemplate = "";
        if (this.ModuleType == BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_REGION)
        {
            huTemplate = TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_HU_TEMPLATE).Value;
        }
        else if (targetOrderDetailList != null &&
                 targetOrderDetailList.Count > 0 &&
                 targetOrderDetailList[0].OrderHead != null &&
                 targetOrderDetailList[0].OrderHead.HuTemplate != null &&
                 targetOrderDetailList[0].OrderHead.HuTemplate.Length > 0)
        {
            huTemplate = targetOrderDetailList[0].OrderHead.HuTemplate;
        }

        if (huTemplate != null && huTemplate.Length > 0)
        {
            IList <object> huDetailObj = new List <object>();
            huDetailObj.Add(huList);
            huDetailObj.Add(CurrentUser.Code);

            string barCodeUrl = "";
            if (packageType == BusinessConstants.CODE_MASTER_PACKAGETYPE_OUTER)
            {
                barCodeUrl = TheReportMgr.WriteToFile(huTemplate, huDetailObj, huTemplate);
            }
            else
            {
                barCodeUrl = TheReportMgr.WriteToFile("Inside" + huTemplate, huDetailObj, "Inside" + huTemplate);
            }
            Page.ClientScript.RegisterStartupScript(GetType(), "method", " <script language='javascript' type='text/javascript'>PrintOrder('" + barCodeUrl + "'); </script>");

            this.ShowSuccessMessage("Inventory.PrintHu.Successful");
        }
    }