Esempio n. 1
0
 void txtBatchNo_OnCompleteSearch()
 {
     txtBatchNo.Text    = txtBatchNo.DataResult["批次号"].ToString();
     txtSpce.Tag        = txtBatchNo.DataResult["供应商编码"].ToString();
     lbUnit.Text        = txtBatchNo.DataResult["单位"].ToString();
     lbStock.Text       = txtBatchNo.DataResult["库存数量"].ToString();
     numUnitPrice.Value = Convert.ToDecimal(txtBatchNo.DataResult["单价"]) == 0 ?
                          m_serverStore.GetGoodsUnitPrice(Convert.ToInt32(tbsGoods.Tag),
                                                          txtBatchNo.Text.ToString(), UniversalFunction.GetStorageID(cmbStorage.Text)) :
                          Convert.ToDecimal(txtBatchNo.DataResult["单价"]);
 }
        /// <summary>
        /// 赋值账务信息
        /// </summary>
        /// <param name="context">数据上下文</param>
        /// <param name="bill">单据信息</param>
        /// <param name="item">明细信息</param>
        /// <returns>返回账务信息对象</returns>
        public S_FetchGoodsDetailBill AssignDetailInfo(DepotManagementDataContext context, S_MaterialReturnedInTheDepot bill,
                                                       S_MaterialListReturnedInTheDepot item)
        {
            IBillTypeServer server   = ServerModuleFactory.GetServerModule <IBillTypeServer>();
            BASE_BillType   billType = server.GetBillTypeFromName("领料退库单");

            if (billType == null)
            {
                throw new Exception("获取不到单据类型信息");
            }

            View_Department department = UniversalFunction.GetDeptInfo(context, bill.Department);

            //单价设置
            decimal dcStockUnitPrice = m_serverStore.GetGoodsUnitPrice(context, item.GoodsID, item.BatchNo, bill.StorageID);

            //S_FetchGoodsDetailBill用于存放每次领料、领料退库的明细信息
            S_FetchGoodsDetailBill detailBill = new S_FetchGoodsDetailBill();

            detailBill.ID               = Guid.NewGuid();
            detailBill.FetchBIllID      = bill.Bill_ID;
            detailBill.BillTime         = ServerTime.Time;
            detailBill.FetchCount       = -item.ReturnedAmount;
            detailBill.GoodsID          = item.GoodsID;
            detailBill.BatchNo          = item.BatchNo;
            detailBill.ProviderBatchNo  = item.ProviderBatchNo;
            detailBill.Provider         = item.Provider;
            detailBill.Price            = -dcStockUnitPrice * (decimal)item.ReturnedAmount;
            detailBill.UnitPrice        = dcStockUnitPrice;
            detailBill.Department       = department.部门名称;
            detailBill.FillInPersonnel  = bill.FillInPersonnel;
            detailBill.FinanceSignatory = null;
            detailBill.DepartDirector   = bill.DepartmentDirector;
            detailBill.DepotManager     = bill.DepotManager;
            detailBill.OperationType    = (int)CE_SubsidiaryOperationType.领料退库;
            detailBill.StorageID        = bill.StorageID;
            detailBill.Remark           = "退库原因:" + bill.ReturnReason + ";备注:" + item.Remark;
            detailBill.FillInDate       = bill.Bill_Time;

            IMaterialRequisitionPurposeServer purposeServer =
                ServerModuleFactory.GetServerModule <IMaterialRequisitionPurposeServer>();

            detailBill.Using = string.Format("领料退库,初始用途:{0}", purposeServer.GetBillPurpose(context, bill.PurposeCode).Purpose);

            return(detailBill);
        }
        private void btnFindBatchNo_Click(object sender, EventArgs e)
        {
            FormQueryInfo form = QueryInfoDialog.GetGoodsForBatchNo(Convert.ToInt32(txtCode.Tag), m_billInfo.StorageID);

            if (form != null && form.ShowDialog() == DialogResult.OK)
            {
                txtBatchNo.Text              = form.GetDataItem("批次号").ToString();
                txtProviderBatchNo.Text      = form.GetDataItem("供方批次号").ToString();
                txtProvider.Text             = form.GetDataItem("供货单位").ToString();
                cmbUnit.Text                 = form.GetDataItem("单位").ToString();
                cmbUnit.SelectedValue        = Convert.ToInt32(form.GetDataItem("单位ID").ToString());
                txtShelf.Text                = form.GetDataItem("货架").ToString();
                txtColumn.Text               = form.GetDataItem("列").ToString();
                txtLayer.Text                = form.GetDataItem("层").ToString();
                cmbGoodsStatus.Text          = form.GetDataItem("物品状态").ToString();
                cmbGoodsStatus.SelectedValue = Convert.ToInt32(form.GetDataItem("物品状态ID").ToString());

                txtZMSL.Text = form.GetDataItem("库存数量").ToString();
                txtZMJE.Tag  = m_serverStore.GetGoodsUnitPrice(Convert.ToInt32(txtCode.Tag), txtBatchNo.Text, m_billInfo.StorageID);
                txtZMJE.Text = (Convert.ToDecimal(form.GetDataItem("库存数量")) * Convert.ToDecimal(txtZMJE.Tag)).ToString();
            }
        }
Esempio n. 4
0
        public decimal GetUnitPrice(CE_InPutBusinessType businessType, string relateBillNo, int goodsID, string batchNo, string storageID)
        {
            try
            {
                decimal resultUnitPrice = 0;

                switch (businessType)
                {
                case CE_InPutBusinessType.生产采购:
                case CE_InPutBusinessType.普通采购:
                case CE_InPutBusinessType.委外采购:
                case CE_InPutBusinessType.样品采购:
                    break;

                case CE_InPutBusinessType.自制件入库:
                    resultUnitPrice = 0;
                    break;

                case CE_InPutBusinessType.领料退库:
                    IStoreServer storeService = ServerModuleFactory.GetServerModule <IStoreServer>();
                    resultUnitPrice = storeService.GetGoodsUnitPrice(goodsID, batchNo, storageID);
                    break;

                case CE_InPutBusinessType.营销入库:
                case CE_InPutBusinessType.营销退库:
                    break;

                default:
                    break;
                }

                return(resultUnitPrice);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }