public DifferenceOrderConfirmCtrl(DifferenceOrder differenceOrder)
 {
     InitializeComponent();
     InitDataGridView();
     this.curDifferenceOrder = differenceOrder;
     this.Initialize(differenceOrder);
 }
Esempio n. 2
0
        //简单打印示例
        public static void Print(DifferenceOrder item, DataGridView dataGridView2, int times = 1)
        {
            GoldPrinter.MisGoldPrinter misGoldPrinter = new GoldPrinter.MisGoldPrinter(false, new PrinterMargins(20, 20, 20, 20, 787, 1129));
            misGoldPrinter.Title   = "差异单";                     //主标题(C#用\n表示换行)
            misGoldPrinter.Caption = "";
            Header header = new Header(3, 2);                   //行列数基本不受限制,但超过一页失去意义,因为以Body为主,以其它为辅

            header.IsDrawAllPage = true;                        //可以指定每页是否重复打印
            header.SetText(0, 0, "差异单号:" + item.ID);
            header.SetText(0, 1, "来源单号:" + item.SourceOrderID); //DataSource可以是字符串、一维数组、二维数组、DataTable、WinDataGrid、WebDataGrid、ListView\ListView、
            header.SetText(1, 0, "发 货 方:" + CommonGlobalCache.GetShopName(item.OutboundShopID));
            header.SetText(1, 1, "收 货 方:" + CommonGlobalCache.GetShopName(item.InboundShopID));
            header.SetText(2, 0, "差异(盈):" + item.DiffCountWin.ToString());
            header.SetText(2, 1, "差异(亏):" + item.DiffCountLost.ToString());
            misGoldPrinter.Header     = header;
            misGoldPrinter.DataSource = DataGridViewUtil.ToStringArray(dataGridView2, true, true);
            if (!Directory.Exists(CommonGlobalUtil.SystemDir + "EXPORTS\\"))
            {
                Directory.CreateDirectory(CommonGlobalUtil.SystemDir + "EXPORTS\\");
            }

            misGoldPrinter.FileName = CommonGlobalUtil.SystemDir + "EXPORTS\\" + item.ID + ".jpg";
            ((GoldPrinter.Body)(misGoldPrinter.Body)).Font = dataGridView2.Font;
            int[] widths = new int[] {
                80, 100, 40, 50,
                30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30
                , 40, 50
            };
            // int[] widths=  DataGridViewUtil.GetColsWidth(dataGridView2);
            List <int> widthList = new List <int>();

            for (int i = 0; i <
                 dataGridView2.Columns.Count; i++)
            {
                if (dataGridView2.Columns[i].Visible)
                {
                    widthList.Add(widths[i]);
                }
            }
            widths = widthList.ToArray();
            int newWidth   = 787;
            int totalWidth = 0;

            for (int i = 0; i < widths.Length; i++)
            {
                totalWidth += widths[i];
            }
            for (int i = 0; i < widths.Length; i++)
            {
                widths[i] = decimal.ToInt32(Math.Round((widths[i] * newWidth * (decimal)1.0 / totalWidth), 0, MidpointRounding.AwayFromZero));
            }
            ((GoldPrinter.Body)(misGoldPrinter.Body)).ColsWidth = widths;
            misGoldPrinter.Preview();
            misGoldPrinter.Dispose();
            misGoldPrinter = null;
        }
Esempio n. 3
0
        private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            DataGridViewRow row   = dataGridView1.Rows[e.RowIndex];
            DifferenceOrder order = (DifferenceOrder)row.DataBoundItem;

            if (Confirmed.Index == e.ColumnIndex)
            {
                e.Value = order.Confirmed ? "已确认" : "未确认";
            }
            else if (SourceType.Index == e.ColumnIndex)
            {
                e.Value = CommonGlobalUtil.OrderType(order.SourceOrderID);
            }
        }
Esempio n. 4
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (!DataGridViewUtil.CheckPerrmisson(this, sender, e))
     {
         return;
     }
     if (e.RowIndex < 0 || e.ColumnIndex < 0)
     {
         return;
     }
     try
     {
         List <DifferenceOrder> list = (List <DifferenceOrder>) this.dataGridView1.DataSource;
         DifferenceOrder        item = (DifferenceOrder)list[e.RowIndex];
         if (e.ColumnIndex == iDDataGridViewTextBoxColumn.Index)
         {
             item.Print = false;
             this.skinSplitContainer1.Panel2Collapsed = false;
             this.DifferenceOrderDetailClick?.Invoke(item, this, this.skinSplitContainer1.Panel2);
         }
         else if (e.ColumnIndex == InboundOrderID.Index)
         {
             this.skinSplitContainer1.Panel2Collapsed = false;
             this.InboundOrderDetailClick?.Invoke(item.InboundOrderID, this, this.skinSplitContainer1.Panel2);
         }
         else if (e.ColumnIndex == OutboundOrderID.Index)
         {
             this.skinSplitContainer1.Panel2Collapsed = false;
             this.OutboundOrderDetailClick?.Invoke(item.OutboundOrderID, this, this.skinSplitContainer1.Panel2);
         }
         else if (e.ColumnIndex == sourceOrderIDDataGridViewTextBoxColumn1.Index)
         {
             /* this.skinSplitContainer1.Panel2Collapsed = false;
              * this.SourceOrderDetailClick?.Invoke(item.SourceOrderID, this, this.skinSplitContainer1.Panel2);*/
         }
         else if (e.ColumnIndex == ColumnPrint.Index)
         {
             item.Print = true;
             this.DifferenceOrderDetailClick?.Invoke(item, this, this.skinSplitContainer1.Panel2);
         }
     }
     catch (Exception ee)
     {
         CommonGlobalUtil.ShowError(ee);
     }
 }
        public void Initialize(DifferenceOrder differenceOrder = null)
        {
            this.skinLabel_OrderID.Text = string.Empty;
            if (this.models != null)
            {
                this.models.Clear();
            }
            else
            {
                this.models = new List <DifferenceDetailConfirmModel>();
            }

            SetDisplay();
            //如果调拨单
            if (CommonGlobalUtil.OrderType(differenceOrder?.SourceOrderID).Equals("调拨"))
            {
                bool canEdit = HasPermission(RolePermissionEnum.编辑);
                baseButtonConfirm.Enabled = canEdit;
                BaseButtonCancel.Enabled  = canEdit;
                if (differenceOrder.Confirmed)
                {
                    baseButtonConfirm.Visible = false;
                    BaseButtonCancel.Visible  = false;
                }
            }
            else
            {
                baseButtonConfirm.Visible = false;
                BaseButtonCancel.Visible  = false;
            }

            if (differenceOrder != null)
            {
                this.curDifferenceOrder = differenceOrder;
            }

            this.skinLabel_SendShop.Visible    = false;
            this.skinLabel_ReceiveShop.Visible = false;
            this.skinLabel_operator.Visible    = false;
            if (this.curDifferenceOrder != null)
            {
                //  盘点单店铺不是本店的  和  差异单发货方不是本店的  不可以确认差异
                skinLabel_operator.Visible  = false;
                this.guideComboBox1.Visible = false;

                this.skinLabel_OrderID.Text     = "差异单号:" + this.curDifferenceOrder.ID;
                this.skinLabel_SendShop.Text    = "发货方:" + CommonGlobalCache.GetShopName(this.curDifferenceOrder.OutboundShopID);
                this.skinLabel_ReceiveShop.Text = "收货方:" + CommonGlobalCache.GetShopName(this.curDifferenceOrder.InboundShopID);
                this.skinLabel_operator.Text    = "操作人:" + CommonGlobalCache.GetUserName(this.curDifferenceOrder.ConfirmUserID);
                if (this.curDifferenceOrder.InboundShopID == this.curDifferenceOrder.OutboundShopID)
                {
                    this.isCheckStoreOrder = true;

                    if (!LoadSnagShot())
                    {
                        return;
                    }
                    outboundCountDataGridViewTextBoxColumn.HeaderText = "账面数";
                    inboundCountDataGridViewTextBoxColumn.HeaderText  = "实盘数";
                    this.skinLabel_SendShop.Visible    = false;
                    this.skinLabel_ReceiveShop.Visible = false;
                    this.checkStoreDetails             = CommonGlobalCache.ServerProxy.GetCheckStoreDetail(this.curDifferenceOrder.SourceOrderID);
                }
                else
                {
                    //this.BaseButtonCancel.Visible = !curDifferenceOrder.Confirmed;
                    //this.baseButtonConfirm.Visible = !curDifferenceOrder.Confirmed;
                    // this.guideComboBox1.Visible = !curDifferenceOrder.Confirmed && IsPos;
                    this.skinLabel_SendShop.Visible    = true;
                    this.skinLabel_ReceiveShop.Visible = true;
                    //this.skinLabel_operator.Visible = true;
                    this.inboundDetails = CommonGlobalCache.ServerProxy.GetInboundDetail(this.curDifferenceOrder.InboundOrderID);
                }

                if (curDifferenceOrder?.OutboundShopID != CommonGlobalCache.CurrentShopID)
                {
                    this.BaseButtonCancel.Visible   = false;
                    this.baseButtonConfirm.Visible  = false;
                    this.guideComboBox1.Visible     = false;
                    this.skinLabel_operator.Visible = false;
                }

                List <DifferenceDetail> differenceDetails = CommonGlobalCache.ServerProxy.GetDifferenceDetail(this.curDifferenceOrder.ID);
                if (differenceDetails != null)
                {
                    foreach (DifferenceDetail detail in differenceDetails)
                    {
                        foreach (string sizeName in CostumeStoreHelper.CostumeSizeColumn)
                        {
                            String dbSize          = sizeName; //CostumeStoreHelper.GetCostumeSize(sizeName, sizeGroup);
                            int    differenceCount = Convert.ToInt32(CJBasic.Helpers.ReflectionHelper.GetProperty(detail, sizeName));

                            if (differenceCount != 0)
                            {
                                //实盘
                                int inboundCount  = this.GetInboundCount(differenceCount, detail, dbSize);
                                int outboundCount = 0;
                                //变化数
                                int changeCount = 0;
                                if (isCheckStoreOrder)
                                {
                                    //盘点单,库存数=盘点数-差异数
                                    changeCount   = this.GetChangeCount(detail, dbSize);
                                    outboundCount = this.GetOutboundCount(detail, dbSize);;
                                }
                                else
                                {
                                    //调拨、补货
                                    outboundCount = inboundCount + differenceCount;
                                }

                                DifferenceDetailConfirmModel model = new DifferenceDetailConfirmModel()
                                {
                                    CostumeID       = detail.CostumeID,
                                    CostumeName     = CommonGlobalCache.GetCostumeName(detail.CostumeID),
                                    ColorName       = detail.ColorName,
                                    SizeName        = dbSize,
                                    DifferenceCount = differenceCount,
                                    InboundCount    = inboundCount,
                                    OutboundCount   = outboundCount,
                                    ChangeCount     = changeCount
                                };
                                this.models.Add(model);
                            }
                        }
                    }
                }
            }
            this.BindingSource();
        }
 public void Search(DifferenceOrder differenceOrder)
 {
     this.curDifferenceOrder = differenceOrder;
     this.Initialize(differenceOrder);
 }