示例#1
0
        public async Task <List <GoodsOrderDetail> > GetOrderDetail(long orderId)
        {
            List <GoodsOrderDetail> list = new List <GoodsOrderDetail>();

            try
            {
                string    sql = $@"select g.Name,i.Count,cast(i.Price as float) Price,
stuff((select ','+isnull([Text],'') from dbo.TCommonSpecValue  
where charindex(cast(id as nvarchar(200)),b.ValueText)>0 for xml path('')),1,1,'') Spec
 from dbo.TGoodsOrderItem i 
left join dbo.TGoods g on i.GoodsId=g.Id 
left join dbo.TCommonSpecObject b on i.SpecObjectId=b.id
where goodsorderid={orderId}";
                DataTable dt  = _sqlExecuter.ExecuteDataSet(sql).Tables[0];
                foreach (DataRow item in dt.Rows)
                {
                    GoodsOrderDetail d = new GoodsOrderDetail();
                    d.Count     = item["Count"].ToString();
                    d.Price     = item["Price"].ToString();
                    d.GoodsSpec = item["Spec"].ToString();
                    d.GoodsName = item["Name"].ToString();
                    list.Add(d);
                }
                return(list);
            }
            catch (Exception e)
            {
                throw new UserFriendlyException(e.StackTrace + e.Message);
            }
        }
示例#2
0
        /// <summary> 获取指定类型币种的货币总额
        /// </summary>
        /// <param name="orderId">订单编号</param>
        /// <param name="currencyType">币种类型1为货币,2为积分</param>
        /// <returns></returns>
        public static decimal GetTotalOrderCurrency(Guid orderId, int currencyType)
        {
            decimal retValue             = 0;
            var     goodsOrderDetail     = new GoodsOrderDetail(GlobalConfig.DB.FromType.Read);
            var     goodsOrderDetailList = goodsOrderDetail.GetGoodsOrderDetailList(orderId);

            if (currencyType == 1)
            {
                retValue +=
                    goodsOrderDetailList.Where(w => w.SellType == (int)SellType.Currency)
                    .Sum(god => god.SellPrice * Convert.ToDecimal(god.Quantity));
            }
            else
            {
                retValue +=
                    goodsOrderDetailList.Where(w => w.SellType == (int)SellType.Score).Sum(god => god.TotalGoodsScore);
            }
            return(retValue);
        }
示例#3
0
        protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e)
        {
            Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict();

            foreach (int rowIndex in modifiedDict.Keys)
            {
                int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]);
                GoodsOrderDetail objInfo = Core.Container.Instance.Resolve <IServiceGoodsOrderDetail>().GetEntity(rowID);
                if (modifiedDict[rowIndex].Keys.Contains("GoodsUnitPrice"))
                {
                    objInfo.GoodsUnitPrice = Convert.ToDecimal(modifiedDict[rowIndex]["GoodsUnitPrice"]);
                }
                if (modifiedDict[rowIndex].Keys.Contains("GoodsNumber"))
                {
                    objInfo.GoodsNumber = Convert.ToDecimal(modifiedDict[rowIndex]["GoodsNumber"]);
                }

                objInfo.GoodTotalPrice = objInfo.GoodsUnitPrice * objInfo.GoodsNumber;

                Core.Container.Instance.Resolve <IServiceGoodsOrderDetail>().Update(objInfo);
            }

            BindGrid();
        }
示例#4
0
        private void tsbSave_Click(object sender, EventArgs e)
        {
            txtRemark.Focus();
            gridView1.UpdateCurrentRow();

            if (txtIncomeDepot.Text == "")
            {
                this.ShowAlertMessage("必须输入收货仓库!");
                return;
            }

            if (dtpGoodsOrderDate.Text == "")
            {
                this.ShowAlertMessage("必须输入开单日期!");
                return;
            }

            if (gridView1.RowCount <= 0)
            {
                this.ShowAlertMessage("必须增加明细数据!");
                return;
            }

            if (txtBatchNO.Text.Trim().Length != 8)
            {
                this.ShowAlertMessage("批号请输入8位日期型,例 yyyyMMdd[20110101]!");
                return;
            }
            else
            {
                string strDate = txtBatchNO.Text.Substring(0, 4) + "-" + txtBatchNO.Text.Substring(4, 2) + "-" + txtBatchNO.Text.Substring(6, 2);
                if (IsDate(strDate) != true)
                {
                    this.ShowAlertMessage("批号输入格式不对,应该为8位日期型,例 yyyyMMdd[20110101]!");
                    return;
                }
            }
            //if (bm.IsExistBillID(txtBillID.Text) == true && this.Tag.ToString() == "add")
            //{
            //    this.ShowAlertMessage("订单号已经存在,请重新输入!");
            //    return;
            //}


            GoodsOrder GoodsOrder = new GoodsOrder();

            GoodsOrder.GoodsOrderGuid = txtGoodsOrderGuid.Text;
            GoodsOrder.GoodsOrderID   = txtGoodsOrderID.Text;
            GoodsOrder.GoodsOrderDate = DateTime.Parse(dtpGoodsOrderDate.Text);
            if (txtIncomeDepot.Tag != null)
            {
                GoodsOrder.IncomeDepot = txtIncomeDepot.Tag.ToString();
            }
            if (txtPlant.Tag != null)
            {
                GoodsOrder.Plant = txtPlant.Tag.ToString();
            }
            if (txtQualityPerson.Tag != null)
            {
                GoodsOrder.QualityPerson = txtQualityPerson.Tag.ToString();
            }
            if (txtSatrapPerson.Tag != null)
            {
                GoodsOrder.SatrapPerson = txtSatrapPerson.Tag.ToString();
            }
            if (txtTransactorPerson.Tag != null)
            {
                GoodsOrder.TransactorPerson = txtTransactorPerson.Tag.ToString();
            }
            if (txtIncomeDepot.Tag != null)
            {
                GoodsOrder.IncomeDepot = txtIncomeDepot.Tag.ToString();
            }

            if (txtDepotPerson.Tag != null)
            {
                GoodsOrder.DepotPerson = txtDepotPerson.Tag.ToString();
            }

            GoodsOrder.BatchNo = txtBatchNO.Text;
            GoodsOrder.Remark  = txtRemark.Text;

            GoodsOrder.CreateGuid = txtCreateGuid.Tag.ToString();
            GoodsOrder.CreateDate = DateTime.Now;
            GoodsOrder.CheckGuid  = "";
            GoodsOrder.CheckDate  = DateTime.Parse("1900-01-01");



            List <GoodsOrderDetail> list             = new List <GoodsOrderDetail>();
            GoodsOrderDetail        GoodsOrderDetail = new GoodsOrderDetail();

            for (int i = 0; i < gridView1.RowCount; i++)
            {
                DataRowView dr = (DataRowView)(gridView1.GetRow(i));

                GoodsOrderDetail = new GoodsOrderDetail();
                GoodsOrderDetail.GoodsOrderGuid = txtGoodsOrderGuid.Text;
                GoodsOrderDetail.MaterialGuID   = dr["MaterialGuID"].ToString();
                if (dr["MaterialSum"].ToString().Trim() != "")
                {
                    GoodsOrderDetail.MaterialSum = decimal.Parse(dr["MaterialSum"].ToString());
                }
                else
                {
                    GoodsOrderDetail.MaterialSum = 0;
                }
                GoodsOrderDetail.Determinant = dr["Determinant"].ToString();

                GoodsOrderDetail.SortID = i;
                list.Add(GoodsOrderDetail);
            }



            //保存
            GoodsOrderManage.SaveBill(GoodsOrder, list);

            tsbCheck.Enabled   = true;
            tsbUnCheck.Enabled = false;

            SetRight();


            //写日志
            SysLog.AddOperateLog(SysParams.UserName, "成品入库单保存", "保存", SysParams.UserName + "用户保存成品入库单,唯一号:" + txtGoodsOrderGuid.Text + ",成品入库单号:" + txtGoodsOrderID.Text);


            //用于打印
            DataTable dtl3 = base.GetDataTable((DataView)gridView1.DataSource);

            ds.Tables.Clear();
            ds.Tables.Add(dtl3.Copy());
            ds.Tables[0].TableName = "GoodsOrderDetail";

            this.Tag = "edit";
            this.ShowMessage("保存成功");

            frmGoodsOrder.frmgoodsorder.LoadData();
        }