コード例 #1
0
 //取消确认时,更改采购需求中已订购数量
 public static SqlCommand WritePurchaseRequireDesc(ProductModel ProductM)
 {
     SqlCommand comm = new SqlCommand();
     StringBuilder sql = new StringBuilder();
     sql.AppendLine("UPDATE officedba.PurchaseRequire ");
     sql.AppendLine("SET OrderCount=isnull(OrderCount,0)-@OrderCount");
     sql.AppendLine(" WHERE ID=@ID");
     //if (((UserInfoUtil)SessionUtil.Session["UserInfo"]).IsMoreUnit)
     //{
     //    comm.Parameters.Add(SqlHelper.GetParameterFromString("@PlanCount", ProductM.UsedUnitCount));
     //}
     //else
     //{
         comm.Parameters.Add(SqlHelper.GetParameterFromString("@OrderCount", ProductM.ProductCount));
     //}
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@ID", ProductM.FromBillID));
     comm.CommandText = sql.ToString();
     return comm;
 }
コード例 #2
0
        public static SqlCommand WriteStorgeDecr(ProductModel ProductM)
        {
            SqlCommand comm = new SqlCommand();
            StringBuilder sql = new StringBuilder();
            if (IsExistInStorge(ProductM.ProductID))
            {
                sql.AppendLine("UPDATE officedba.StorageProduct   ");
                sql.AppendLine(" SET RoadCount = isnull(RoadCount,0)-@RoadCount");
                sql.AppendLine(" WHERE ProductID = @ProductID ");
                sql.AppendLine(" AND StorageID = (SELECT StorageID FROM officedba.ProductInfo WHERE ID=@ProductID)");
                sql.AppendLine(" AND CompanyCD = @CompanyCD");

                comm.Parameters.Add(SqlHelper.GetParameterFromString("@ProductID", ProductM.ProductID));
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@RoadCount", ProductM.ProductCount));
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD));
                comm.CommandText = sql.ToString();
            }
            else
            {
                sql.AppendLine("INSERT INTO officedba.StorageProduct                                                                   ");
                sql.AppendLine("SELECT @CompanyCD,(SELECT StorageID FROM officedba.ProductInfo WHERE ID=@ProductID),@ProductID,null,");
                sql.AppendLine("null,null,@RoadCount,null,null                                                                         ");


                comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD));
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@ProductID", ProductM.ProductID));
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@RoadCount", (0 - Convert.ToInt32(ProductM.ProductCount)).ToString()));
                comm.CommandText = sql.ToString();
            }
            return comm;
        }
コード例 #3
0
        //取消确认时回写采购申请
        public static SqlCommand WritePurchaseApplyDesc(ProductModel ProductM)
        {
            SqlCommand comm = new SqlCommand();
            StringBuilder sql = new StringBuilder();
            sql.AppendLine("UPDATE officedba.PurchaseApplyDetail");
            sql.AppendLine(" SET PlanedCount=isnull(PlanedCount,0)-@PlanCount");
            sql.AppendLine(" WHERE CompanyCD=@CompanyCD");
            sql.AppendLine(" AND ApplyNo=@FromBillNo");
            sql.AppendLine(" AND SortNo=@FromLineNo");

            comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD));
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@FromBillNo", ProductM.FromBillNo));
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@FromLineNo", ProductM.FromLineNo));
            if (((UserInfoUtil)SessionUtil.Session["UserInfo"]).IsMoreUnit)
            {
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@PlanCount", ProductM.UsedUnitCount));
            }
            else
            {
                comm.Parameters.Add(SqlHelper.GetParameterFromString("@PlanCount", ProductM.ProductCount));
            }
            comm.CommandText = sql.ToString();
            return comm;
        }
コード例 #4
0
        public static SqlCommand WriteBack(string Flag, ProductModel ProductM)
        {
            SqlCommand comm = new SqlCommand();
            StringBuilder sql = new StringBuilder();
            switch (Flag)
            {
                case "Contact"://回写合同表
                    sql.AppendLine("UPDATE officedba.PurchaseContractDetail    ");
                    sql.AppendLine("   SET OrderCount = (isnull(OrderCount,0)+@OrderCount) ");
                    sql.AppendLine(" WHERE ContractNo=@FromBillNo ");
                    sql.AppendLine(" AND CompanyCD=@CompanyCD");
                    sql.AppendLine(" AND SortNo=@SortNo");

                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@OrderCount", ProductM.ProductCount));
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@FromBillNo", ProductM.FromBillNo));
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD));
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@SortNo", ProductM.FromLineNo));
                    break;
                case "Plan"://回写计划表
                    sql.AppendLine("UPDATE officedba.PurchasePlanDetail    ");
                    sql.AppendLine("   SET OrderCount = (isnull(OrderCount,0)+@OrderCount) ");
                    sql.AppendLine(" WHERE PlanNo=@FromBillNo");
                    sql.AppendLine(" AND CompanyCD=@CompanyCD");
                    sql.AppendLine(" AND SortNo=@SortNo");

                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@OrderCount", ProductM.ProductCount));
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@FromBillNo", ProductM.FromBillNo));
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD));
                    comm.Parameters.Add(SqlHelper.GetParameterFromString("@SortNo", ProductM.FromLineNo));
                    break;
            }
            comm.CommandText = sql.ToString();

            return comm;
        }