コード例 #1
0
        private void LoadGrid(object[] dataObjects)
        {
            if (this.opsLoadMetrial.Value == "0")
            {
                _DataTableLoadedPart.Clear();
            }

            int needBatchNumber = Convert.ToInt32(this.edtMoPlanQty.Value.Trim());
            int needNumber      = 0;

            int[] lotNeedNumberList = new int[dataObjects.Length];

            //计算每行发料数量
            for (int i = 0; i < dataObjects.Length; i++)
            {
                int lotSendNumber = 0;
                MaterialLotWithItemDesc materialLotWithItemDesc = (MaterialLotWithItemDesc)dataObjects[i];

                string lastItemCode = string.Empty;
                if (i > 0)
                {
                    MaterialLotWithItemDesc materialLotWithItemDescLast = (MaterialLotWithItemDesc)dataObjects[i - 1];
                    lastItemCode = materialLotWithItemDescLast.ItemCode;
                }
                if (lastItemCode != materialLotWithItemDesc.ItemCode)
                {
                    SBOMFacade SBOMFacade  = new SBOMFacade(this.DataProvider);
                    decimal    sBomItemQty = SBOMFacade.GetSbomItemQtyWithMo(materialLotWithItemDesc.ItemCode, FormatHelper.CleanString(this.edtMoCode.Value.Trim().ToUpper()));
                    needNumber = Convert.ToInt32(Math.Ceiling(needBatchNumber * sBomItemQty));
                }

                lotSendNumber        = Math.Min(materialLotWithItemDesc.LotQty, needNumber);
                lotNeedNumberList[i] = lotSendNumber;
                needNumber          -= lotSendNumber;
            }


            for (int i = 0; i < dataObjects.Length; i++)
            {
                Domain.Material.MaterialLotWithItemDesc materialLotWithItemDesc = (Domain.Material.MaterialLotWithItemDesc)dataObjects[i];

                _DataTableLoadedPart.Rows.Add(new object[] {
                    true,
                    materialLotWithItemDesc.MaterialLotNo,
                    materialLotWithItemDesc.IQCNo,
                    materialLotWithItemDesc.STLine,
                    materialLotWithItemDesc.VendorCode,
                    materialLotWithItemDesc.VendorDesc,
                    materialLotWithItemDesc.ItemCode,
                    materialLotWithItemDesc.ItemDesc,
                    materialLotWithItemDesc.CreateDate,
                    materialLotWithItemDesc.LotQty,
                    lotNeedNumberList[i],
                    materialLotWithItemDesc.OrganizationID,
                    materialLotWithItemDesc.StorageID,
                    materialLotWithItemDesc.Unit
                });
            }
        }
コード例 #2
0
        private void ucBtnQuery_Click(object sender, EventArgs e)
        {
            _DataTableLoadedPart.Clear();

            string materialLotNo   = FormatString(this.ucBatch.Value).ToUpper();
            string storage         = FormatString(this.ucLabelComboxStorageOut.SelectedItemValue).ToUpper();
            string iqcNo           = FormatString(this.ucLabelEditDoc.Value).ToUpper();
            string item            = FormatString(this.ucLEItemCode.Value).ToUpper();
            int    stockInDateFrom = FormatHelper.TODateInt(ucDateStockInFrom.Value);
            int    stockInDateTo   = FormatHelper.TODateInt(ucDateStockInTo.Value);
            string vendor          = FormatString(this.ucLabelEditVendor.Value).ToUpper();

            if (stockInDateTo < stockInDateFrom)
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Alert_ReceiveDate_Compare"));
                ucDateStockInFrom.Focus();
                return;
            }

            object[] MaterialLotDetial = this.InvFacade.QueryMaterialIssue(materialLotNo, storage, iqcNo, item, stockInDateFrom, stockInDateTo, vendor);
            if (MaterialLotDetial == null)
            {
                ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_Not_Find_Metrial"));
                this.ucBatch.TextFocus(false, true);
                return;
            }
            for (int i = 0; i < MaterialLotDetial.Length; i++)
            {
                Domain.Material.MaterialLotWithItemDesc materialLotWithItemDesc = (Domain.Material.MaterialLotWithItemDesc)MaterialLotDetial[i];

                _DataTableLoadedPart.Rows.Add(new object[] {
                    false,
                    materialLotWithItemDesc.MaterialLotNo,
                    materialLotWithItemDesc.IQCNo,
                    materialLotWithItemDesc.STLine,
                    materialLotWithItemDesc.VendorCode,
                    materialLotWithItemDesc.VendorDesc,
                    materialLotWithItemDesc.ItemCode,
                    materialLotWithItemDesc.ItemDesc,
                    materialLotWithItemDesc.CreateDate,
                    materialLotWithItemDesc.LotQty,
                    0,
                    materialLotWithItemDesc.OrganizationID,
                    materialLotWithItemDesc.StorageID,
                    materialLotWithItemDesc.Unit
                });
            }
        }