コード例 #1
0
        /// <summary>
        /// 根据备货单明细ID 获取备货单明细记录对象
        /// </summary>
        /// <param name="stock_Item_Id"></param>
        public OrdStockUpItemModel GetOrdStockUpItemModel(string stock_Item_Id)
        {
            List <DbParameter> parameters = new List <DbParameter>();

            StringBuilder strSql = new StringBuilder();

            strSql.Append(@"Select
                            osi.ID,
                            osi.COMMERCE_NAME,
                            osi.PRODUCT_NAME,
                            op.COMMON_NAME,
                            osi.BRAND,
                            osi.MANUFACTURE_ID,
                            osi.MANUFACTURE_NAME,
                            osi.MANUFACTURE_NAME_ABBR,
                            osi.SPEC,
                            osi.MODEL,
                            osi.BARCODE,
                            osi.BATCH_NO,
                            osi.NUM,
                            osi.VALID_DATE,
                            osi.REMARK,
                            op.price,
                            op.REG_NO,
                            op.REG_VALID_DATE,
                            op.SALER_ID,
                            op.SALER_NAME,
                            op.SALER_NAME_ABBR,
                            op.BASE_MEASURE,
                            op.PERFORMANCE,
                            (case osi.STATE when '1' then '未确认' when '2' then '已确认' when '3' then '完成' when '4' then '作废' end) As StateName
                            From HC_ORD_ORD_STOCK_ITEM As osi,HC_ORD_PRODUCT As op
                            Where osi.DATA_PRODUCT_ID=op.DATA_PRODUCT_ID and osi.PROJECT_ID=op.PROJECT_ID");

            if (!string.IsNullOrEmpty(stock_Item_Id))
            {
                strSql.Append(" And osi.ID=:stock_Item_Id");
                DbParameter strStock_Item_Id = DbFacade.CreateParameter();
                strStock_Item_Id.ParameterName = "stock_Item_Id";
                strStock_Item_Id.DbType        = DbType.String;
                strStock_Item_Id.Value         = stock_Item_Id;
                parameters.Add(strStock_Item_Id);
            }
            else
            {
                return(null);
            }

            OrdStockUpItemModel model = null;

            model = base.DbFacade.SQLExecuteObject(strSql.ToString(), new MapRow(StockUpItemModel), parameters.ToArray()) as OrdStockUpItemModel;

            return(model);
        }
コード例 #2
0
        /// <summary>
        /// 获取当前备货单明细对象
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        private OrdStockUpItemModel GetOrdStockUpItemModel(DataRow dr)
        {
            OrdStockUpItemModel model = new OrdStockUpItemModel();

            //model.Barcode = dr["BARCODE"].ToString();
            //model.Barcode_Back = dr["Barcode_Back"].ToString();
            model.Id       = dr["ID"].ToString();
            model.Stock_Id = dr["Stock_Id"].ToString();

            //model.Data_Product_Id = dr["DATA_PRODUCT_ID"].ToString();
            //model.Store_Room_Id = dr["STORE_ROOM_ID"].ToString();
            //model.Store_Room_Name = dr["STORE_ROOM_NAME"].ToString();

            return(model);
        }
コード例 #3
0
        /// <summary>
        /// 修改备货单明细条码
        /// </summary>
        /// <param name="ordStockUpItemModel"></param>
        public void UpdateBarcodeOrdStockUpItem(OrdStockUpItemModel ordStockUpItemModel, DbTransaction transaction)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("Update HC_ORD_ORD_STOCK_ITEM ");
            strSql.Append("Set ");
            strSql.Append(" SYNC_STATE='0',");
            strSql.AppendFormat("BARCODE='{0}'", ordStockUpItemModel.Barcode_Back);

            strSql.AppendFormat(" Where ID='{0}'", ordStockUpItemModel.Id);

            try
            {
                base.DbFacade.SQLExecuteNonQuery(strSql.ToString(), transaction);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
0
        /// <summary>
        /// 采购备货单信息对象
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="rowNumber">The row number.</param>
        /// <returns></returns>
        private object StockUpItemModel(IDataReader reader, int row)
        {
            OrdStockUpItemModel model = new OrdStockUpItemModel();

            model.Id               = Convert.ToString(reader["ID"]);
            model.Commerce_Name    = Convert.ToString(reader["COMMERCE_NAME"]);
            model.Product_Name     = Convert.ToString(reader["PRODUCT_NAME"]);
            model.Brand            = Convert.ToString(reader["BRAND"]);
            model.Manufacture_Name = Convert.ToString(reader["MANUFACTURE_NAME"]);
            model.Spec             = Convert.ToString(reader["SPEC"]);
            model.Model            = Convert.ToString(reader["MODEL"]);
            model.Barcode          = Convert.ToString(reader["BARCODE"]);
            model.Batch_No         = Convert.ToString(reader["BATCH_NO"]);
            model.Num              = Convert.ToString(reader["NUM"]);
            model.Valid_Date       = Convert.ToString(reader["VALID_DATE"]);
            model.Remark           = Convert.ToString(reader["REMARK"]);
            model.Price            = Convert.ToString(reader["price"]);
            model.Reg_No           = Convert.ToString(reader["REG_NO"]);
            model.Reg_Valid_Date   = Convert.ToString(reader["REG_VALID_DATE"]);
            model.Saler_Name       = Convert.ToString(reader["SALER_NAME"]);
            model.Base_Measure     = Convert.ToString(reader["BASE_MEASURE"]);

            return(model);
        }
コード例 #5
0
        /// <summary>
        /// 备货单确认事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAffirm_Click(object sender, EventArgs e)
        {
            //提示信息
            //if (XtraMessageBox.Show("确认是否备货单确认操作?", Constant.MsgTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            //    return;

            //进行数据验证
            string strError = string.Empty;

            if (!ValiData_ByGrid(out strError))
            {
                XtraMessageBox.Show(strError, Constant.MsgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            try
            {
                //保存到二级库存表
                List <OrdSecondAyplnvModel> ListOrdSecondAyplnvModel = new List <OrdSecondAyplnvModel>();

                //获取已选择数据集
                DataTable dt = StockUpItemDt.DefaultView.ToTable();

                foreach (DataRow dr in dt.Rows)
                {
                    string strSel = dr["Sel"].ToString();

                    if (strSel.Equals("1"))
                    {
                        OrdSecondAyplnvModel model = GetOrdSecondAyplnvModel(dr);

                        ListOrdSecondAyplnvModel.Add(model);
                    }
                }
                SaveListOrdSecondAyplnvModelList(ListOrdSecondAyplnvModel);
                //----------------------------------------------------------------------------------

                //2.修改主表及明细表状态----------------------------------------------------
                List <OrdStockUpItemModel> ListOrdStockUpItemModel = new List <OrdStockUpItemModel>();
                foreach (DataRow dr in dt.Rows)
                {
                    string strSel = dr["Sel"].ToString();

                    if (strSel.Equals("1"))
                    {
                        OrdStockUpItemModel model = GetOrdStockUpItemModel(dr);

                        ListOrdStockUpItemModel.Add(model);
                    }
                }

                if (ListOrdStockUpItemModel.Count > 0)
                {
                    OrdStockUpItemBLL.GetInstance().UpdateBarcodeOrdStockUpItemList(ListOrdStockUpItemModel, strStockUpID);
                }
                //----------------------------------------------------------------------------------

                XtraMessageBox.Show("备货单确认成功!", Constant.MsgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);

                //备货单确认后刷新数据集
                RefreshData();
                //更新标题
                IniData(strStockUpID);

                EditFlag = true;

                //this.Close();
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("备货单确认失败!", Constant.MsgTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }