Beispiel #1
0
 /// <summary>
 /// 获取入库信息数据
 /// </summary>
 /// <returns></returns>
 internal ConPurchaseOrderRowInputDto getData()
 {
     if (Check.Checked)
     {
         string[] locDatas = lblLoc.BindDataValue.ToString().Split('/');
         ConPurchaseOrderRowInputDto conPOW = new ConPurchaseOrderRowInputDto();
         conPOW.CID     = lblName.BindDataValue.ToString();
         conPOW.POROWID = Convert.ToInt32(imgCon.BindDataValue);
         conPOW.WAREID  = locDatas[0];
         conPOW.STID    = locDatas[1];
         conPOW.SLID    = locDatas[2];
         if (numInStoQuant.Value == 0)
         {
             conPOW.QUANTRETREATED = Convert.ToDecimal(lblQuant.Text);
         }
         else
         {
             if (Convert.ToDecimal(numInStoQuant.Value) > Convert.ToDecimal(lblQuant.Text))
             {
                 throw new Exception("实际退库数量不可大于可退库数量!");
             }
             conPOW.QUANTRETREATED = Convert.ToDecimal(numInStoQuant.Value);
         }
         return(conPOW);
     }
     else
     {
         return(null);
     }
 }
Beispiel #2
0
 /// <summary>
 /// 获取入库信息数据
 /// </summary>
 /// <returns></returns>
 internal ConPurchaseOrderRowInputDto getData()
 {
     if (Check.Checked)
     {
         ConPurchaseOrderRowInputDto conPOW = new ConPurchaseOrderRowInputDto();
         conPOW.CID     = lblName.BindDataValue.ToString();
         conPOW.POROWID = Convert.ToInt32(imgCon.BindDataValue);
         if (numInStoQuant.Value == 0)
         {
             conPOW.QUANTSTORED = Convert.ToDecimal(lblQuant.Text);
         }
         else
         {
             if (Convert.ToDecimal(numInStoQuant.Value) > Convert.ToDecimal(lblQuant.Text))
             {
                 throw new Exception("实际入库数量不可大于可入库数量!");
             }
             conPOW.QUANTSTORED = Convert.ToDecimal(numInStoQuant.Value);
         }
         return(conPOW);
     }
     else
     {
         return(null);
     }
 }
        /// <summary>
        /// 创建采购单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Press(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(txtName.Text))
                {
                    throw new Exception("采购单名称不能为空!");
                }
                if (btnDealMan.Tag == null)
                {
                    throw new Exception("请选择采购人!");
                }
                ConPurchaseOrderInputDto Data = new ConPurchaseOrderInputDto();
                Data.REALID     = txtRealID.Text;
                Data.NAME       = txtName.Text;
                Data.PURCHASER  = btnDealMan.Tag.ToString();
                Data.VID        = Convert.ToInt32(btnVendor.Tag);
                Data.CREATEUSER = Client.Session["UserID"].ToString();
                Data.CREATEDATE = DateTime.Now;
                Data.MODIFYUSER = Client.Session["UserID"].ToString();
                Data.MODIFYDATE = DateTime.Now;
                List <ConPurchaseOrderRowInputDto> RowData = new List <ConPurchaseOrderRowInputDto>();
                //获取行项数据
                foreach (ListViewRow Row in ListCons.Rows)
                {
                    frmPurchaseCreateLayout     Layout = Row.Control as frmPurchaseCreateLayout;
                    ConPurAndSaleCreateInputDto conPurAndSaleCreateInputDto = Layout.getData();
                    ConPurchaseOrderRowInputDto row = new ConPurchaseOrderRowInputDto();
                    row.CID            = conPurAndSaleCreateInputDto.CID;
                    row.IMAGE          = conPurAndSaleCreateInputDto.IMAGE;
                    row.QUANTPURCHASED = conPurAndSaleCreateInputDto.QUANTPURCHASED;
                    row.REALPRICE      = conPurAndSaleCreateInputDto.REALPRICE;
                    RowData.Add(row);
                }

                Data.RowData = RowData;
                ReturnInfo RInfo = new ReturnInfo();

                if (String.IsNullOrEmpty(POID))     //创建耗材采购单
                {
                    RInfo = autofacConfig.ConPurchaseOrderService.AddPurchaseOrder(Data);
                    if (RInfo.IsSuccess)     //创建成功
                    {
                        this.Close();        //关闭当前界面,返回到列表界面
                        ShowResult = ShowResult.Yes;
                        Toast("采购单" + RInfo.ErrorInfo + "创建成功!");
                    }
                    else       //创建失败
                    {
                        throw new Exception(RInfo.ErrorInfo);
                    }
                }
                else               //更新耗材采购单
                {
                    Data.POID = POID;
                    RInfo     = autofacConfig.ConPurchaseOrderService.UpdatePruchaseOrder(Data);
                    if (RInfo.IsSuccess)     //创建成功
                    {
                        this.Close();        //关闭当前界面,返回到列表界面
                        ShowResult = ShowResult.Yes;
                        Toast("采购单" + POID + "编辑成功!");
                    }
                    else       //创建失败
                    {
                        throw new Exception(RInfo.ErrorInfo);
                    }
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }