public void UpdateItemInfo(string MOQ, string PPQ, string PackageInfo, string FNumber, string ItemID)
        {
            if (!string.IsNullOrEmpty(FNumber))
            {
                if (!string.IsNullOrEmpty(MOQ))
                {
                    MOQ = Math.Round(Convert.ToDecimal(MOQ), 10).ToString();
                }
                if (!string.IsNullOrEmpty(PPQ))
                {
                    PPQ = Math.Round(Convert.ToDecimal(PPQ), 10).ToString();
                }
                #region 更新日志数据
                //若有料号 直接更新
                //若更新前无数据 则先插入
                JD_IcItem_LogDal dal       = new JD_IcItem_LogDal();
                ICItemPlanDal    plandal   = new ICItemPlanDal();
                ICItemCustomDal  customdal = new ICItemCustomDal();
                #region 若更新前无数据 则先插入
                if (!dal.IsExist(FNumber))
                {
                    ICItemPlan   modelPlan = plandal.Detail(FNumber);
                    ICItemCustom modelCus  = customdal.Detail(FNumber);
                    if (modelPlan != null && modelCus != null)
                    {
                        dal.Add(new JD_IcItem_Log
                        {
                            FNumber     = FNumber,
                            MOQ         = modelPlan.FQtyMin,
                            PPQ         = modelPlan.FBatchAppendQty,
                            PackageInfo = modelCus.F_112,
                            CreateTime  = DateTime.Now
                        });
                    }
                }
                #endregion

                #region 日志中保存数据
                dal.Add(new JD_IcItem_Log
                {
                    CreateTime  = DateTime.Now,
                    MOQ         = Convert.ToDecimal(MOQ),
                    PPQ         = Convert.ToDecimal(PPQ),
                    FNumber     = FNumber,
                    PackageInfo = PackageInfo
                });
                #endregion

                #endregion

                #region 更新K3 PPQ MOQ
                plandal.UpdateInLimitApply(MOQ, PPQ, FNumber);
                customdal.UpdateInLimitApply(PackageInfo, FNumber);
                #endregion
            }
            else
            {
                common.WriteLogs(Common.FileType.采购限价申请.ToString(), ItemID, "---FNumber不存在---");
            }
        }
예제 #2
0
        public static string K3connectionString = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).AppSettings.Settings["K3ConnectionString"].Value; //连接信息


        /// <summary>
        /// 对象t_ICItemCustom明细
        /// 编写人:ywk
        /// 编写日期:2018/7/24 星期二
        /// </summary>
        public ICItemCustom Detail(string FNumber)
        {
            SqlConnection con = new SqlConnection(K3connectionString);
            SqlCommand    cmd = new SqlCommand("SELECT  *  FROM  t_ICItemCustom where FItemID in(select FItemID from t_ICItem where FNumber =@m_FNumber)", con);

            con.Open();


            cmd.Parameters.Add(new SqlParameter("@m_FNumber", SqlDbType.NVarChar, 50)).Value = FNumber;

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

            if (myReader.Read())
            {
                if (!Convert.IsDBNull(myReader["FItemID"]))
                {
                    myDetail.FItemID = Convert.ToInt32(myReader["FItemID"]);
                }
                if (!Convert.IsDBNull(myReader["F_108"]))
                {
                    myDetail.F_108 = Convert.ToString(myReader["F_108"]);
                }
                if (!Convert.IsDBNull(myReader["F_109"]))
                {
                    myDetail.F_109 = Convert.ToString(myReader["F_109"]);
                }
                if (!Convert.IsDBNull(myReader["F_111"]))
                {
                    myDetail.F_111 = Convert.ToInt32(myReader["F_111"]);
                }
                if (!Convert.IsDBNull(myReader["F_112"]))
                {
                    myDetail.F_112 = Convert.ToString(myReader["F_112"]);
                }
                if (!Convert.IsDBNull(myReader["F_113"]))
                {
                    myDetail.F_113 = Convert.ToInt32(myReader["F_113"]);
                }
                if (!Convert.IsDBNull(myReader["F_114"]))
                {
                    myDetail.F_114 = Convert.ToString(myReader["F_114"]);
                }
                if (!Convert.IsDBNull(myReader["F_115"]))
                {
                    myDetail.F_115 = Convert.ToString(myReader["F_115"]);
                }
                if (!Convert.IsDBNull(myReader["F_116"]))
                {
                    myDetail.F_116 = Convert.ToDouble(myReader["F_116"]);
                }
                if (!Convert.IsDBNull(myReader["F_117"]))
                {
                    myDetail.F_117 = Convert.ToString(myReader["F_117"]);
                }
                if (!Convert.IsDBNull(myReader["F_118"]))
                {
                    myDetail.F_118 = Convert.ToInt32(myReader["F_118"]);
                }
                if (!Convert.IsDBNull(myReader["F_119"]))
                {
                    myDetail.F_119 = Convert.ToDouble(myReader["F_119"]);
                }
                if (!Convert.IsDBNull(myReader["F_120"]))
                {
                    myDetail.F_120 = Convert.ToString(myReader["F_120"]);
                }
                if (!Convert.IsDBNull(myReader["F_121"]))
                {
                    myDetail.F_121 = Convert.ToInt32(myReader["F_121"]);
                }
                if (!Convert.IsDBNull(myReader["F_122"]))
                {
                    myDetail.F_122 = Convert.ToDouble(myReader["F_122"]);
                }
            }

            myReader.Close();

            cmd.Dispose();
            con.Close();
            con.Dispose();
            return(myDetail);
        }