コード例 #1
0
        protected void UpdateInfo(string ItemID)
        {
            JD_IcItemBGApply_Log model = Detail(Convert.ToInt32(ItemID));
            string ErrorMsg            = string.Empty;

            if (model != null)
            {
                try {
                    //更新最小订购量 批量增量   固定提前期   包装量说明 物料单价系数
                    string FQtyMin         = Math.Round(Convert.ToDecimal(model.FQtyMinNew), 10).ToString();
                    string FBatchAppendQty = Math.Round(Convert.ToDecimal(model.FBatchAppendQtyNew), 10).ToString();
                    UpdateK3Item(model.FItemID.ToString(), FQtyMin, FBatchAppendQty, model.FFixLeadTimeNew.ToString(), model.PackageInfoNew, model.PriceCoeffientNew.ToString());
                    //更新本地阶梯价的MOQ PPQ LT
                    UpdateCuPriceDetail(model.FNumber, model.FQtyMinNew, model.FBatchAppendQtyNew, model.FFixLeadTimeNew);
                }
                catch (Exception ex)
                {
                    ErrorMsg = ex.Message;
                }
                finally {
                    model.IsUpdate   = 1;
                    model.UpdateTime = DateTime.Now;
                    Update(model);
                    common.AddLogQueue(model.TaskID, "JD_IcItemBGApply_Log", model.ItemID, "SQL", ErrorMsg);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 对象JD_IcItemBGApply_Log明细
        /// 编写人:ywk
        /// 编写日期:2018/9/19 星期三
        /// </summary>
        protected JD_IcItemBGApply_Log Detail(int ItemID)
        {
            SqlConnection con = new SqlConnection(connectionString);
            SqlCommand    cmd = new SqlCommand("SELECT * FROM JD_IcItemBGApply_Log WHERE ItemID = @m_ItemID", con);

            con.Open();


            cmd.Parameters.Add(new SqlParameter("@m_ItemID", SqlDbType.Int, 0)).Value = ItemID;

            JD_IcItemBGApply_Log myDetail = new JD_IcItemBGApply_Log();
            SqlDataReader        myReader = cmd.ExecuteReader();

            if (myReader.Read())
            {
                if (!Convert.IsDBNull(myReader["ItemID"]))
                {
                    myDetail.ItemID = Convert.ToInt32(myReader["ItemID"]);
                }
                if (!Convert.IsDBNull(myReader["FItemID"]))
                {
                    myDetail.FItemID = Convert.ToInt32(myReader["FItemID"]);
                }
                if (!Convert.IsDBNull(myReader["Requester"]))
                {
                    myDetail.Requester = Convert.ToString(myReader["Requester"]);
                }
                if (!Convert.IsDBNull(myReader["CreateTime"]))
                {
                    myDetail.CreateTime = Convert.ToDateTime(myReader["CreateTime"]);
                }
                if (!Convert.IsDBNull(myReader["RequestDept"]))
                {
                    myDetail.RequestDept = Convert.ToString(myReader["RequestDept"]);
                }
                if (!Convert.IsDBNull(myReader["SNumber"]))
                {
                    myDetail.SNumber = Convert.ToString(myReader["SNumber"]);
                }
                if (!Convert.IsDBNull(myReader["TaskID"]))
                {
                    myDetail.TaskID = Convert.ToInt32(myReader["TaskID"]);
                }
                if (!Convert.IsDBNull(myReader["FNumber"]))
                {
                    myDetail.FNumber = Convert.ToString(myReader["FNumber"]);
                }
                if (!Convert.IsDBNull(myReader["FModel"]))
                {
                    myDetail.FModel = Convert.ToString(myReader["FModel"]);
                }
                if (!Convert.IsDBNull(myReader["FQtyMin"]))
                {
                    myDetail.FQtyMin = Convert.ToDecimal(myReader["FQtyMin"]);
                }
                if (!Convert.IsDBNull(myReader["FQtyMinNew"]))
                {
                    myDetail.FQtyMinNew = Convert.ToDecimal(myReader["FQtyMinNew"]);
                }
                if (!Convert.IsDBNull(myReader["FBatchAppendQty"]))
                {
                    myDetail.FBatchAppendQty = Convert.ToDecimal(myReader["FBatchAppendQty"]);
                }
                if (!Convert.IsDBNull(myReader["FBatchAppendQtyNew"]))
                {
                    myDetail.FBatchAppendQtyNew = Convert.ToDecimal(myReader["FBatchAppendQtyNew"]);
                }
                if (!Convert.IsDBNull(myReader["FFixLeadTime"]))
                {
                    myDetail.FFixLeadTime = Convert.ToInt32(myReader["FFixLeadTime"]);
                }
                if (!Convert.IsDBNull(myReader["FFixLeadTimeNew"]))
                {
                    myDetail.FFixLeadTimeNew = Convert.ToInt32(myReader["FFixLeadTimeNew"]);
                }
                if (!Convert.IsDBNull(myReader["PackageInfo"]))
                {
                    myDetail.PackageInfo = Convert.ToString(myReader["PackageInfo"]);
                }
                if (!Convert.IsDBNull(myReader["PackageInfoNew"]))
                {
                    myDetail.PackageInfoNew = Convert.ToString(myReader["PackageInfoNew"]);
                }
                if (!Convert.IsDBNull(myReader["PriceCoeffient"]))
                {
                    myDetail.PriceCoeffient = Convert.ToDouble(myReader["PriceCoeffient"]);
                }
                if (!Convert.IsDBNull(myReader["PriceCoeffientNew"]))
                {
                    myDetail.PriceCoeffientNew = Convert.ToDouble(myReader["PriceCoeffientNew"]);
                }
                if (!Convert.IsDBNull(myReader["Remarks"]))
                {
                    myDetail.Remarks = Convert.ToString(myReader["Remarks"]);
                }
                if (!Convert.IsDBNull(myReader["IsUpdate"]))
                {
                    myDetail.IsUpdate = Convert.ToInt32(myReader["IsUpdate"]);
                }
                if (!Convert.IsDBNull(myReader["UpdateTime"]))
                {
                    myDetail.UpdateTime = Convert.ToDateTime(myReader["UpdateTime"]);
                }
            }

            myReader.Close();

            cmd.Dispose();
            con.Close();
            con.Dispose();
            return(myDetail);
        }
コード例 #3
0
        /// <summary>
        /// 更新JD_IcItemBGApply_Log对象
        /// 编写人:ywk
        /// 编写日期:2018/9/19 星期三
        /// </summary>
        protected void Update(JD_IcItemBGApply_Log model)
        {
            SqlConnection con = new SqlConnection(connectionString);
            SqlCommand    cmd = new SqlCommand("UPDATE JD_IcItemBGApply_Log SET FItemID = @m_FItemID,Requester = @m_Requester,CreateTime = @m_CreateTime,RequestDept = @m_RequestDept,SNumber = @m_SNumber,TaskID = @m_TaskID,FNumber = @m_FNumber,FModel = @m_FModel,FQtyMin = @m_FQtyMin,FQtyMinNew = @m_FQtyMinNew,FBatchAppendQty = @m_FBatchAppendQty,FBatchAppendQtyNew = @m_FBatchAppendQtyNew,FFixLeadTime = @m_FFixLeadTime,FFixLeadTimeNew = @m_FFixLeadTimeNew,PackageInfo = @m_PackageInfo,PackageInfoNew = @m_PackageInfoNew,PriceCoeffient = @m_PriceCoeffient,PriceCoeffientNew = @m_PriceCoeffientNew,Remarks = @m_Remarks,IsUpdate = @m_IsUpdate,UpdateTime = @m_UpdateTime WHERE ItemID = @m_ItemID", con);

            con.Open();

            if (model.FItemID == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_FItemID", SqlDbType.Int, 0)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_FItemID", SqlDbType.Int, 0)).Value = model.FItemID;
            }
            if (model.Requester == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_Requester", SqlDbType.NVarChar, 50)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_Requester", SqlDbType.NVarChar, 50)).Value = model.Requester;
            }
            if (model.CreateTime == new DateTime())
            {
                cmd.Parameters.Add(new SqlParameter("@m_CreateTime", SqlDbType.DateTime, 0)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_CreateTime", SqlDbType.DateTime, 0)).Value = model.CreateTime;
            }
            if (model.RequestDept == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_RequestDept", SqlDbType.NVarChar, 50)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_RequestDept", SqlDbType.NVarChar, 50)).Value = model.RequestDept;
            }
            if (model.SNumber == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_SNumber", SqlDbType.NVarChar, 50)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_SNumber", SqlDbType.NVarChar, 50)).Value = model.SNumber;
            }
            if (model.TaskID == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_TaskID", SqlDbType.Int, 0)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_TaskID", SqlDbType.Int, 0)).Value = model.TaskID;
            }
            if (model.FNumber == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_FNumber", SqlDbType.NVarChar, 50)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_FNumber", SqlDbType.NVarChar, 50)).Value = model.FNumber;
            }
            if (model.FModel == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_FModel", SqlDbType.NText, 0)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_FModel", SqlDbType.NText, 0)).Value = model.FModel;
            }
            if (model.FQtyMin == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_FQtyMin", SqlDbType.Decimal, 18)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_FQtyMin", SqlDbType.Decimal, 18)).Value = model.FQtyMin;
            }
            if (model.FQtyMinNew == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_FQtyMinNew", SqlDbType.Decimal, 18)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_FQtyMinNew", SqlDbType.Decimal, 18)).Value = model.FQtyMinNew;
            }
            if (model.FBatchAppendQty == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_FBatchAppendQty", SqlDbType.Decimal, 18)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_FBatchAppendQty", SqlDbType.Decimal, 18)).Value = model.FBatchAppendQty;
            }
            if (model.FBatchAppendQtyNew == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_FBatchAppendQtyNew", SqlDbType.Decimal, 18)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_FBatchAppendQtyNew", SqlDbType.Decimal, 18)).Value = model.FBatchAppendQtyNew;
            }
            if (model.FFixLeadTime == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_FFixLeadTime", SqlDbType.Int, 0)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_FFixLeadTime", SqlDbType.Int, 0)).Value = model.FFixLeadTime;
            }
            if (model.FFixLeadTimeNew == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_FFixLeadTimeNew", SqlDbType.Int, 0)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_FFixLeadTimeNew", SqlDbType.Int, 0)).Value = model.FFixLeadTimeNew;
            }
            if (model.PackageInfo == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_PackageInfo", SqlDbType.NVarChar, 100)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_PackageInfo", SqlDbType.NVarChar, 100)).Value = model.PackageInfo;
            }
            if (model.PackageInfoNew == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_PackageInfoNew", SqlDbType.NVarChar, 100)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_PackageInfoNew", SqlDbType.NVarChar, 100)).Value = model.PackageInfoNew;
            }
            if (model.PriceCoeffient == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_PriceCoeffient", SqlDbType.Float, 0)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_PriceCoeffient", SqlDbType.Float, 0)).Value = model.PriceCoeffient;
            }
            if (model.PriceCoeffientNew == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_PriceCoeffientNew", SqlDbType.Float, 0)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_PriceCoeffientNew", SqlDbType.Float, 0)).Value = model.PriceCoeffientNew;
            }
            if (model.Remarks == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_Remarks", SqlDbType.NVarChar, 100)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_Remarks", SqlDbType.NVarChar, 100)).Value = model.Remarks;
            }
            if (model.IsUpdate == null)
            {
                cmd.Parameters.Add(new SqlParameter("@m_IsUpdate", SqlDbType.Int, 0)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_IsUpdate", SqlDbType.Int, 0)).Value = model.IsUpdate;
            }
            if (model.UpdateTime == new DateTime())
            {
                cmd.Parameters.Add(new SqlParameter("@m_UpdateTime", SqlDbType.DateTime, 0)).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@m_UpdateTime", SqlDbType.DateTime, 0)).Value = model.UpdateTime;
            }
            cmd.Parameters.Add(new SqlParameter("@m_ItemID", SqlDbType.Int, 0)).Value = model.ItemID;

            try { cmd.ExecuteNonQuery(); }
            catch (Exception e) { throw new Exception(e.ToString()); }
            cmd.Dispose();
            con.Close();
            con.Dispose();
        }